diff --git a/internal/services/netapp/client/client.go b/internal/services/netapp/client/client.go index 16c7c10fbee2..8ff393abbfa9 100644 --- a/internal/services/netapp/client/client.go +++ b/internal/services/netapp/client/client.go @@ -1,39 +1,49 @@ package client import ( - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) type Client struct { - AccountClient *netapp.AccountsClient - PoolClient *netapp.PoolsClient - VolumeClient *netapp.VolumesClient - SnapshotClient *netapp.SnapshotsClient - SnapshotPoliciesClient *netapp.SnapshotPoliciesClient + AccountClient *netappaccounts.NetAppAccountsClient + PoolClient *capacitypools.CapacityPoolsClient + VolumeClient *volumes.VolumesClient + VolumeReplicationClient *volumesreplication.VolumesReplicationClient + SnapshotClient *snapshots.SnapshotsClient + SnapshotPoliciesClient *snapshotpolicy.SnapshotPolicyClient } func NewClient(o *common.ClientOptions) *Client { - accountClient := netapp.NewAccountsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + accountClient := netappaccounts.NewNetAppAccountsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&accountClient.Client, o.ResourceManagerAuthorizer) - poolClient := netapp.NewPoolsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + poolClient := capacitypools.NewCapacityPoolsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&poolClient.Client, o.ResourceManagerAuthorizer) - volumeClient := netapp.NewVolumesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + volumeClient := volumes.NewVolumesClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&volumeClient.Client, o.ResourceManagerAuthorizer) - snapshotClient := netapp.NewSnapshotsClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + volumeReplicationClient := volumesreplication.NewVolumesReplicationClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&volumeReplicationClient.Client, o.ResourceManagerAuthorizer) + + snapshotClient := snapshots.NewSnapshotsClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&snapshotClient.Client, o.ResourceManagerAuthorizer) - snapshotPoliciesClient := netapp.NewSnapshotPoliciesClientWithBaseURI(o.ResourceManagerEndpoint, o.SubscriptionId) + snapshotPoliciesClient := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI(o.ResourceManagerEndpoint) o.ConfigureClient(&snapshotPoliciesClient.Client, o.ResourceManagerAuthorizer) return &Client{ - AccountClient: &accountClient, - PoolClient: &poolClient, - VolumeClient: &volumeClient, - SnapshotClient: &snapshotClient, - SnapshotPoliciesClient: &snapshotPoliciesClient, + AccountClient: &accountClient, + PoolClient: &poolClient, + VolumeClient: &volumeClient, + VolumeReplicationClient: &volumeReplicationClient, + SnapshotClient: &snapshotClient, + SnapshotPoliciesClient: &snapshotPoliciesClient, } } diff --git a/internal/services/netapp/netapp_account_data_source.go b/internal/services/netapp/netapp_account_data_source.go index 7b4012061bf9..27699a8203b1 100644 --- a/internal/services/netapp/netapp_account_data_source.go +++ b/internal/services/netapp/netapp_account_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppAccount() *pluginsdk.Resource { @@ -44,10 +44,10 @@ func dataSourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + id := netappaccounts.NewNetAppAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + resp, err := client.AccountsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -55,10 +55,13 @@ func dataSourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) er } d.SetId(id.ID()) - d.Set("name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + + } return nil } diff --git a/internal/services/netapp/netapp_account_resource.go b/internal/services/netapp/netapp_account_resource.go index 4dc362e895b8..ab1ab8e2cc92 100644 --- a/internal/services/netapp/netapp_account_resource.go +++ b/internal/services/netapp/netapp_account_resource.go @@ -9,14 +9,15 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -37,7 +38,7 @@ func resourceNetAppAccount() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.AccountID(id) + _, err := netappaccounts.ParseNetAppAccountID(id) return err }), @@ -102,7 +103,7 @@ func resourceNetAppAccount() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -113,37 +114,30 @@ func resourceNetAppAccountCreate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) + id := netappaccounts.NewNetAppAccountID(subscriptionId, d.Get("resource_group_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + existing, err := client.AccountsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_account", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) - activeDirectories := d.Get("active_directory").([]interface{}) - - accountParameters := netapp.Account{ - Location: utils.String(location), - AccountProperties: &netapp.AccountProperties{ - ActiveDirectories: expandNetAppActiveDirectories(activeDirectories), + accountParameters := netappaccounts.NetAppAccount{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Properties: &netappaccounts.AccountProperties{ + ActiveDirectories: expandNetAppActiveDirectories(d.Get("active_directory").([]interface{})), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.CreateOrUpdate(ctx, accountParameters, id.ResourceGroup, id.NetAppAccountName) - if err != nil { + if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, accountParameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } // Wait for account to complete create if err := waitForAccountCreateOrUpdate(ctx, client, id); err != nil { @@ -159,21 +153,21 @@ func resourceNetAppAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := netappaccounts.ParseNetAppAccountID(d.Id()) if err != nil { return err } shouldUpdate := false - update := netapp.AccountPatch{ - AccountProperties: &netapp.AccountProperties{}, + update := netappaccounts.NetAppAccountPatch{ + Properties: &netappaccounts.AccountProperties{}, } if d.HasChange("active_directory") { shouldUpdate = true activeDirectoriesRaw := d.Get("active_directory").([]interface{}) activeDirectories := expandNetAppActiveDirectories(activeDirectoriesRaw) - update.AccountProperties.ActiveDirectories = activeDirectories + update.Properties.ActiveDirectories = activeDirectories } if d.HasChange("tags") { @@ -183,16 +177,12 @@ func resourceNetAppAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) er } if shouldUpdate { - future, err := client.Update(ctx, update, id.ResourceGroup, id.NetAppAccountName) - if err != nil { - return fmt.Errorf("updating Account %q: %+v", id.NetAppAccountName, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", id, err) + if err = client.AccountsUpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id.ID(), err) } // Wait for account to complete update - if err := waitForAccountCreateOrUpdate(ctx, client, *id); err != nil { + if err = waitForAccountCreateOrUpdate(ctx, client, *id); err != nil { return err } } @@ -205,14 +195,14 @@ func resourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) erro ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := netappaccounts.ParseNetAppAccountID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + resp, err := client.AccountsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -220,14 +210,16 @@ func resourceNetAppAccountRead(d *pluginsdk.ResourceData, meta interface{}) erro return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNetAppAccountDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -235,30 +227,26 @@ func resourceNetAppAccountDelete(d *pluginsdk.ResourceData, meta interface{}) er ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.AccountID(d.Id()) + id, err := netappaccounts.ParseNetAppAccountID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName) - if err != nil { + if err := client.AccountsDeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) - } return nil } -func expandNetAppActiveDirectories(input []interface{}) *[]netapp.ActiveDirectory { - results := make([]netapp.ActiveDirectory, 0) +func expandNetAppActiveDirectories(input []interface{}) *[]netappaccounts.ActiveDirectory { + results := make([]netappaccounts.ActiveDirectory, 0) for _, item := range input { v := item.(map[string]interface{}) dns := strings.Join(*utils.ExpandStringSlice(v["dns_servers"].([]interface{})), ",") - result := netapp.ActiveDirectory{ - DNS: utils.String(dns), + result := netappaccounts.ActiveDirectory{ + Dns: utils.String(dns), Domain: utils.String(v["domain"].(string)), OrganizationalUnit: utils.String(v["organizational_unit"].(string)), Password: utils.String(v["password"].(string)), @@ -271,7 +259,7 @@ func expandNetAppActiveDirectories(input []interface{}) *[]netapp.ActiveDirector return &results } -func waitForAccountCreateOrUpdate(ctx context.Context, client *netapp.AccountsClient, id parse.AccountId) error { +func waitForAccountCreateOrUpdate(ctx context.Context, client *netappaccounts.NetAppAccountsClient, id netappaccounts.NetAppAccountId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -293,15 +281,15 @@ func waitForAccountCreateOrUpdate(ctx context.Context, client *netapp.AccountsCl return nil } -func netappAccountStateRefreshFunc(ctx context.Context, client *netapp.AccountsClient, id parse.AccountId) pluginsdk.StateRefreshFunc { +func netappAccountStateRefreshFunc(ctx context.Context, client *netappaccounts.NetAppAccountsClient, id netappaccounts.NetAppAccountId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + res, err := client.AccountsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Account %q (Resource Group %q): %s", id.NetAppAccountName, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id.ID(), err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/internal/services/netapp/netapp_account_resource_test.go b/internal/services/netapp/netapp_account_resource_test.go index 7cf258ded663..25561e2a54df 100644 --- a/internal/services/netapp/netapp_account_resource_test.go +++ b/internal/services/netapp/netapp_account_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -120,17 +120,17 @@ func testAccNetAppAccount_update(t *testing.T) { } func (t NetAppAccountResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.AccountID(state.ID) + id, err := netappaccounts.ParseNetAppAccountID(state.ID) if err != nil { return nil, err } - resp, err := clients.NetApp.AccountClient.Get(ctx, id.ResourceGroup, id.NetAppAccountName) + resp, err := clients.NetApp.AccountClient.AccountsGet(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Netapp Account (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (NetAppAccountResource) basicConfig(data acceptance.TestData) string { diff --git a/internal/services/netapp/netapp_pool_data_source.go b/internal/services/netapp/netapp_pool_data_source.go index f5d2dde7fc1a..28972ab23ba7 100644 --- a/internal/services/netapp/netapp_pool_data_source.go +++ b/internal/services/netapp/netapp_pool_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppPool() *pluginsdk.Resource { @@ -58,10 +58,10 @@ func dataSourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error defer cancel() subscriptionId := meta.(*clients.Client).Account.SubscriptionId - id := parse.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + id := capacitypools.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + resp, err := client.PoolsGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } @@ -69,17 +69,14 @@ func dataSourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("account_name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) - - d.Set("location", location.NormalizeNilable(resp.Location)) - - if poolProperties := resp.PoolProperties; poolProperties != nil { - d.Set("service_level", string(poolProperties.ServiceLevel)) - if poolProperties.Size != nil { - d.Set("size_in_tb", *poolProperties.Size/1099511627776) - } + d.Set("name", id.PoolName) + d.Set("account_name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) + + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + d.Set("service_level", string(model.Properties.ServiceLevel)) + d.Set("size_in_tb", model.Properties.Size/1099511627776) } return nil diff --git a/internal/services/netapp/netapp_pool_resource.go b/internal/services/netapp/netapp_pool_resource.go index 944ee8063cb9..1c8839e7fdd1 100644 --- a/internal/services/netapp/netapp_pool_resource.go +++ b/internal/services/netapp/netapp_pool_resource.go @@ -7,13 +7,14 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -34,7 +35,7 @@ func resourceNetAppPool() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.CapacityPoolID(id) + _, err := capacitypools.ParseCapacityPoolID(id) return err }), @@ -62,9 +63,9 @@ func resourceNetAppPool() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.ServiceLevelPremium), - string(netapp.ServiceLevelStandard), - string(netapp.ServiceLevelUltra), + string(capacitypools.ServiceLevelPremium), + string(capacitypools.ServiceLevelStandard), + string(capacitypools.ServiceLevelUltra), }, false), }, @@ -79,12 +80,12 @@ func resourceNetAppPool() *pluginsdk.Resource { Optional: true, Computed: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.QosTypeAuto), - string(netapp.QosTypeManual), + string(capacitypools.QosTypeAuto), + string(capacitypools.QosTypeManual), }, false), }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } @@ -95,47 +96,42 @@ func resourceNetAppPoolCreate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + id := capacitypools.NewCapacityPoolID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + existing, err := client.PoolsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_pool", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) - serviceLevel := d.Get("service_level").(string) sizeInTB := int64(d.Get("size_in_tb").(int)) sizeInMB := sizeInTB * 1024 * 1024 sizeInBytes := sizeInMB * 1024 * 1024 - capacityPoolParameters := netapp.CapacityPool{ - Location: utils.String(location), - PoolProperties: &netapp.PoolProperties{ - ServiceLevel: netapp.ServiceLevel(serviceLevel), - Size: utils.Int64(sizeInBytes), + capacityPoolParameters := capacitypools.CapacityPool{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Properties: capacitypools.PoolProperties{ + ServiceLevel: capacitypools.ServiceLevel(d.Get("service_level").(string)), + Size: sizeInBytes, }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } if qosType, ok := d.GetOk("qos_type"); ok { - capacityPoolParameters.PoolProperties.QosType = netapp.QosType(qosType.(string)) + qos := capacitypools.QosType(qosType.(string)) + capacityPoolParameters.Properties.QosType = &qos } - future, err := client.CreateOrUpdate(ctx, capacityPoolParameters, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { + if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, capacityPoolParameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } - // Wait for pool to complete update + // Wait for pool to complete create if err := waitForPoolCreateOrUpdate(ctx, client, id); err != nil { return err } @@ -149,14 +145,14 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CapacityPoolID(d.Id()) + id, err := capacitypools.ParseCapacityPoolID(d.Id()) if err != nil { return err } shouldUpdate := false - update := netapp.CapacityPoolPatch{ - PoolPatchProperties: &netapp.PoolPatchProperties{}, + update := capacitypools.CapacityPoolPatch{ + Properties: &capacitypools.PoolPatchProperties{}, } if d.HasChange("size_in_tb") { @@ -166,13 +162,13 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error sizeInMB := sizeInTB * 1024 * 1024 sizeInBytes := sizeInMB * 1024 * 1024 - update.PoolPatchProperties.Size = utils.Int64(sizeInBytes) + update.Properties.Size = utils.Int64(sizeInBytes) } if d.HasChange("qos_type") { shouldUpdate = true - qosType := d.Get("qos_type") - update.PoolPatchProperties.QosType = netapp.QosType(qosType.(string)) + qosType := capacitypools.QosType(d.Get("qos_type").(string)) + update.Properties.QosType = &qosType } if d.HasChange("tags") { @@ -182,16 +178,12 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error } if shouldUpdate { - future, err := client.Update(ctx, update, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { - return fmt.Errorf("updating Capacity Pool %q: %+v", id.Name, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", id, err) + if err = client.PoolsUpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id.ID(), err) } // Wait for pool to complete update - if err := waitForPoolCreateOrUpdate(ctx, client, *id); err != nil { + if err = waitForPoolCreateOrUpdate(ctx, client, *id); err != nil { return err } } @@ -204,14 +196,14 @@ func resourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CapacityPoolID(d.Id()) + id, err := capacitypools.ParseCapacityPoolID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + resp, err := client.PoolsGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s does not exist - removing from state", *id) d.SetId("") return nil @@ -219,26 +211,31 @@ func resourceNetAppPoolRead(d *pluginsdk.ResourceData, meta interface{}) error { return fmt.Errorf("retrieving %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if poolProperties := resp.PoolProperties; poolProperties != nil { + d.Set("name", id.PoolName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + poolProperties := model.Properties d.Set("service_level", poolProperties.ServiceLevel) sizeInTB := int64(0) - if poolProperties.Size != nil { - sizeInBytes := *poolProperties.Size - sizeInMB := sizeInBytes / 1024 / 1024 - sizeInTB = sizeInMB / 1024 / 1024 - } + sizeInBytes := poolProperties.Size + sizeInMB := sizeInBytes / 1024 / 1024 + sizeInTB = sizeInMB / 1024 / 1024 d.Set("size_in_tb", int(sizeInTB)) - d.Set("qos_type", string(poolProperties.QosType)) + qosType := "" + if poolProperties.QosType != nil { + qosType = string(*poolProperties.QosType) + } + d.Set("qos_type", qosType) + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNetAppPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -246,18 +243,14 @@ func resourceNetAppPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.CapacityPoolID(d.Id()) + id, err := capacitypools.ParseCapacityPoolID(d.Id()) if err != nil { return err } - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { + if err := client.PoolsDeleteThenPoll(ctx, *id); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q: %+v", id, err) - } // The resource NetApp Pool depends on the resource NetApp Account. // Although the delete API returns 404 which means the NetApp Pool resource has been deleted. @@ -286,20 +279,20 @@ func resourceNetAppPoolDelete(d *pluginsdk.ResourceData, meta interface{}) error return nil } -func netappPoolDeleteStateRefreshFunc(ctx context.Context, client *netapp.PoolsClient, id parse.CapacityPoolId) pluginsdk.StateRefreshFunc { +func netappPoolDeleteStateRefreshFunc(ctx context.Context, client *capacitypools.CapacityPoolsClient, id capacitypools.CapacityPoolId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + res, err := client.PoolsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { + if !response.WasNotFound(res.HttpResponse) { return nil, "", fmt.Errorf("retrieving %s: %+v", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } -func waitForPoolCreateOrUpdate(ctx context.Context, client *netapp.PoolsClient, id parse.CapacityPoolId) error { +func waitForPoolCreateOrUpdate(ctx context.Context, client *capacitypools.CapacityPoolsClient, id capacitypools.CapacityPoolId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -321,15 +314,15 @@ func waitForPoolCreateOrUpdate(ctx context.Context, client *netapp.PoolsClient, return nil } -func netappPoolStateRefreshFunc(ctx context.Context, client *netapp.PoolsClient, id parse.CapacityPoolId) pluginsdk.StateRefreshFunc { +func netappPoolStateRefreshFunc(ctx context.Context, client *capacitypools.CapacityPoolsClient, id capacitypools.CapacityPoolId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + res, err := client.PoolsGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Capacity Pool %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id.ID(), err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/internal/services/netapp/netapp_pool_resource_test.go b/internal/services/netapp/netapp_pool_resource_test.go index 59457816bd30..111e24b4b173 100644 --- a/internal/services/netapp/netapp_pool_resource_test.go +++ b/internal/services/netapp/netapp_pool_resource_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -108,17 +108,17 @@ func TestAccNetAppPool_update(t *testing.T) { } func (t NetAppPoolResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.CapacityPoolID(state.ID) + id, err := capacitypools.ParseCapacityPoolID(state.ID) if err != nil { return nil, err } - resp, err := clients.NetApp.PoolClient.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + resp, err := clients.NetApp.PoolClient.PoolsGet(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Netapp Pool (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (NetAppPoolResource) basic(data acceptance.TestData) string { diff --git a/internal/services/netapp/netapp_snapshot_data_source.go b/internal/services/netapp/netapp_snapshot_data_source.go index 306338ab3902..e5f7e540f7c9 100644 --- a/internal/services/netapp/netapp_snapshot_data_source.go +++ b/internal/services/netapp/netapp_snapshot_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppSnapshot() *pluginsdk.Resource { @@ -60,23 +60,25 @@ func dataSourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + id := snapshots.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) } d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - d.Set("pool_name", id.CapacityPoolName) + d.Set("name", id.SnapshotName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + d.Set("pool_name", id.PoolName) d.Set("volume_name", id.VolumeName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) + } return nil } diff --git a/internal/services/netapp/netapp_snapshot_policy_data_source.go b/internal/services/netapp/netapp_snapshot_policy_data_source.go index 5e449469091f..227a1d90e9af 100644 --- a/internal/services/netapp/netapp_snapshot_policy_data_source.go +++ b/internal/services/netapp/netapp_snapshot_policy_data_source.go @@ -4,15 +4,15 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppSnapshotPolicy() *pluginsdk.Resource { @@ -159,10 +159,10 @@ func dataSourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSnapshotPolicyID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + id := snapshotpolicy.NewSnapshotPoliciesID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) + resp, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -170,13 +170,14 @@ func dataSourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interfac d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("account_name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.SnapshotPolicyName) + d.Set("account_name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if props := resp.SnapshotPolicyProperties; props != nil { + props := model.Properties d.Set("enabled", props.Enabled) if err := d.Set("hourly_schedule", flattenNetAppVolumeSnapshotPolicyHourlySchedule(props.HourlySchedule)); err != nil { return fmt.Errorf("setting `hourly_schedule`: %+v", err) diff --git a/internal/services/netapp/netapp_snapshot_policy_resource.go b/internal/services/netapp/netapp_snapshot_policy_resource.go index 78c363e8bc0e..13e39b898c31 100644 --- a/internal/services/netapp/netapp_snapshot_policy_resource.go +++ b/internal/services/netapp/netapp_snapshot_policy_resource.go @@ -8,13 +8,14 @@ import ( "strings" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -35,7 +36,7 @@ func resourceNetAppSnapshotPolicy() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SnapshotPolicyID(id) + _, err := snapshotpolicy.ParseSnapshotPoliciesID(id) return err }), @@ -189,68 +190,50 @@ func resourceNetAppSnapshotPolicy() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), }, } } func resourceNetAppSnapshotPolicyCreate(d *pluginsdk.ResourceData, meta interface{}) error { client := meta.(*clients.Client).NetApp.SnapshotPoliciesClient + subscriptionId := meta.(*clients.Client).Account.SubscriptionId ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - accountName := d.Get("account_name").(string) + id := snapshotpolicy.NewSnapshotPoliciesID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, resourceGroup, accountName, name) + existing, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { - return fmt.Errorf("checking for presence of existing NetApp SnapshotPolicy %q (Resource Group %q): %+v", name, resourceGroup, err) + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id.ID(), err) } } - if existing.ID != nil && *existing.ID != "" { - return tf.ImportAsExistsError("azurerm_netapp_snapshot_policy", *existing.ID) + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError("azurerm_netapp_snapshot_policy", id.ID()) } } - location := azure.NormalizeLocation(d.Get("location").(string)) - - enabled := d.Get("enabled").(bool) - - hourlyScheduleRaw := d.Get("hourly_schedule").([]interface{}) - hourlySchedule := expandNetAppSnapshotPolicyHourlySchedule(hourlyScheduleRaw) - - dailyScheduleRaw := d.Get("daily_schedule").([]interface{}) - dailySchedule := expandNetAppSnapshotPolicyDailySchedule(dailyScheduleRaw) - - weeklyScheduleRaw := d.Get("weekly_schedule").([]interface{}) - weeklySchedule := expandNetAppSnapshotPolicyWeeklySchedule(weeklyScheduleRaw) - - monthlyScheduleRaw := d.Get("monthly_schedule").([]interface{}) - monthlySchedule := expandNetAppSnapshotPolicyMonthlySchedule(monthlyScheduleRaw) - - parameters := netapp.SnapshotPolicy{ - Location: utils.String(location), - Name: utils.String(name), - SnapshotPolicyProperties: &netapp.SnapshotPolicyProperties{ - HourlySchedule: hourlySchedule, - DailySchedule: dailySchedule, - WeeklySchedule: weeklySchedule, - MonthlySchedule: monthlySchedule, - Enabled: utils.Bool(enabled), + parameters := snapshotpolicy.SnapshotPolicy{ + Location: azure.NormalizeLocation(d.Get("location").(string)), + Name: utils.String(id.SnapshotPolicyName), + Properties: snapshotpolicy.SnapshotPolicyProperties{ + HourlySchedule: expandNetAppSnapshotPolicyHourlySchedule(d.Get("hourly_schedule").([]interface{})), + DailySchedule: expandNetAppSnapshotPolicyDailySchedule(d.Get("daily_schedule").([]interface{})), + WeeklySchedule: expandNetAppSnapshotPolicyWeeklySchedule(d.Get("weekly_schedule").([]interface{})), + MonthlySchedule: expandNetAppSnapshotPolicyMonthlySchedule(d.Get("monthly_schedule").([]interface{})), + Enabled: utils.Bool(d.Get("enabled").(bool)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - if _, err := client.Create(ctx, parameters, resourceGroup, accountName, name); err != nil { - return fmt.Errorf("creating NetApp SnapshotPolicy %q (Resource Group %q): %+v", name, resourceGroup, err) + if _, err := client.SnapshotPoliciesCreate(ctx, id, parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) } // Waiting for snapshot policy be completely provisioned - id := parse.NewSnapshotPolicyID(client.SubscriptionID, resourceGroup, accountName, name) - log.Printf("[DEBUG] Waiting for NetApp Snapshot Policy Provisioning Service %q (Resource Group %q) to complete", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to complete", id) if err := waitForSnapshotPolicyCreation(ctx, client, id, d.Timeout(pluginsdk.TimeoutDelete)); err != nil { return err } @@ -265,46 +248,26 @@ func resourceNetAppSnapshotPolicyUpdate(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - name := d.Get("name").(string) - resourceGroup := d.Get("resource_group_name").(string) - accountName := d.Get("account_name").(string) - - location := azure.NormalizeLocation(d.Get("location").(string)) - - enabled := d.Get("enabled").(bool) - - hourlyScheduleRaw := d.Get("hourly_schedule").([]interface{}) - hourlySchedule := expandNetAppSnapshotPolicyHourlySchedule(hourlyScheduleRaw) - - dailyScheduleRaw := d.Get("daily_schedule").([]interface{}) - dailySchedule := expandNetAppSnapshotPolicyDailySchedule(dailyScheduleRaw) - - weeklyScheduleRaw := d.Get("weekly_schedule").([]interface{}) - weeklySchedule := expandNetAppSnapshotPolicyWeeklySchedule(weeklyScheduleRaw) - - monthlyScheduleRaw := d.Get("monthly_schedule").([]interface{}) - monthlySchedule := expandNetAppSnapshotPolicyMonthlySchedule(monthlyScheduleRaw) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(d.Id()) + if err != nil { + return err + } - parameters := netapp.SnapshotPolicyPatch{ - Location: utils.String(location), - Name: utils.String(name), - SnapshotPolicyProperties: &netapp.SnapshotPolicyProperties{ - HourlySchedule: hourlySchedule, - DailySchedule: dailySchedule, - WeeklySchedule: weeklySchedule, - MonthlySchedule: monthlySchedule, - Enabled: utils.Bool(enabled), + parameters := snapshotpolicy.SnapshotPolicyPatch{ + Location: utils.String(azure.NormalizeLocation(d.Get("location").(string))), + Name: utils.String(id.SnapshotPolicyName), + Properties: &snapshotpolicy.SnapshotPolicyProperties{ + HourlySchedule: expandNetAppSnapshotPolicyHourlySchedule(d.Get("hourly_schedule").([]interface{})), + DailySchedule: expandNetAppSnapshotPolicyDailySchedule(d.Get("daily_schedule").([]interface{})), + WeeklySchedule: expandNetAppSnapshotPolicyWeeklySchedule(d.Get("weekly_schedule").([]interface{})), + MonthlySchedule: expandNetAppSnapshotPolicyMonthlySchedule(d.Get("monthly_schedule").([]interface{})), + Enabled: utils.Bool(d.Get("enabled").(bool)), }, Tags: tags.Expand(d.Get("tags").(map[string]interface{})), } - future, err := client.Update(ctx, parameters, resourceGroup, accountName, name) - if err != nil { - return fmt.Errorf("updating NetApp SnapshotPolicy %q (Resource Group %q): %+v", name, resourceGroup, err) - } - - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation/update of %q (Resource Group %q): %+v", name, resourceGroup, err) + if err = client.SnapshotPoliciesUpdateThenPoll(ctx, *id, parameters); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } return resourceNetAppSnapshotPolicyRead(d, meta) @@ -315,44 +278,47 @@ func resourceNetAppSnapshotPolicyRead(d *pluginsdk.ResourceData, meta interface{ ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotPolicyID(d.Id()) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + resp, err := client.SnapshotPoliciesGet(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] NetApp SnapshotPolicy %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading NetApp SnapshotPolicy %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("reading %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if props := resp.SnapshotPolicyProperties; props != nil { + d.Set("name", id.SnapshotPolicyName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + props := model.Properties d.Set("enabled", props.Enabled) - if err := d.Set("hourly_schedule", flattenNetAppVolumeSnapshotPolicyHourlySchedule(props.HourlySchedule)); err != nil { + if err = d.Set("hourly_schedule", flattenNetAppVolumeSnapshotPolicyHourlySchedule(props.HourlySchedule)); err != nil { return fmt.Errorf("setting `hourly_schedule`: %+v", err) } - if err := d.Set("daily_schedule", flattenNetAppVolumeSnapshotPolicyDailySchedule(props.DailySchedule)); err != nil { + if err = d.Set("daily_schedule", flattenNetAppVolumeSnapshotPolicyDailySchedule(props.DailySchedule)); err != nil { return fmt.Errorf("setting `daily_schedule`: %+v", err) } - if err := d.Set("weekly_schedule", flattenNetAppVolumeSnapshotPolicyWeeklySchedule(props.WeeklySchedule)); err != nil { + if err = d.Set("weekly_schedule", flattenNetAppVolumeSnapshotPolicyWeeklySchedule(props.WeeklySchedule)); err != nil { return fmt.Errorf("setting `weekly_schedule`: %+v", err) } - if err := d.Set("monthly_schedule", flattenNetAppVolumeSnapshotPolicyMonthlySchedule(props.MonthlySchedule)); err != nil { + if err = d.Set("monthly_schedule", flattenNetAppVolumeSnapshotPolicyMonthlySchedule(props.MonthlySchedule)); err != nil { return fmt.Errorf("setting `monthly_schedule`: %+v", err) } + + return tags.FlattenAndSet(d, model.Tags) } - return tags.FlattenAndSet(d, resp.Tags) + return nil } func resourceNetAppSnapshotPolicyDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -360,21 +326,17 @@ func resourceNetAppSnapshotPolicyDelete(d *pluginsdk.ResourceData, meta interfac ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotPolicyID(d.Id()) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(d.Id()) if err != nil { return err } // Deleting snapshot policy and waiting for it fo fully complete the operation - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) - if err != nil { - return fmt.Errorf("deleting NetApp Snapshot Policy %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if err = client.SnapshotPoliciesDeleteThenPoll(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } - log.Printf("[DEBUG] Waiting for NetApp SnapshotPolicy Provisioning Service %q (Resource Group %q) to be deleted", id.Name, id.ResourceGroup) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) - } + log.Printf("[DEBUG] Waiting for %s to be deleted", id) if err := waitForSnapshotPolicyDeletion(ctx, client, *id, d.Timeout(pluginsdk.TimeoutDelete)); err != nil { return err } @@ -382,98 +344,98 @@ func resourceNetAppSnapshotPolicyDelete(d *pluginsdk.ResourceData, meta interfac return nil } -func expandNetAppSnapshotPolicyHourlySchedule(input []interface{}) *netapp.HourlySchedule { +func expandNetAppSnapshotPolicyHourlySchedule(input []interface{}) *snapshotpolicy.HourlySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.HourlySchedule{} + return &snapshotpolicy.HourlySchedule{} } - hourlyScheduleObject := netapp.HourlySchedule{} + hourlyScheduleObject := snapshotpolicy.HourlySchedule{} hourlyScheduleRaw := input[0].(map[string]interface{}) if v, ok := hourlyScheduleRaw["snapshots_to_keep"]; ok { - hourlyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + hourlyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if v, ok := hourlyScheduleRaw["minute"]; ok { - hourlyScheduleObject.Minute = utils.Int32(int32(v.(int))) + hourlyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &hourlyScheduleObject } -func expandNetAppSnapshotPolicyDailySchedule(input []interface{}) *netapp.DailySchedule { +func expandNetAppSnapshotPolicyDailySchedule(input []interface{}) *snapshotpolicy.DailySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.DailySchedule{} + return &snapshotpolicy.DailySchedule{} } - dailyScheduleObject := netapp.DailySchedule{} + dailyScheduleObject := snapshotpolicy.DailySchedule{} dailyScheduleRaw := input[0].(map[string]interface{}) if v, ok := dailyScheduleRaw["snapshots_to_keep"]; ok { - dailyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + dailyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if v, ok := dailyScheduleRaw["hour"]; ok { - dailyScheduleObject.Hour = utils.Int32(int32(v.(int))) + dailyScheduleObject.Hour = utils.Int64(int64(v.(int))) } if v, ok := dailyScheduleRaw["minute"]; ok { - dailyScheduleObject.Minute = utils.Int32(int32(v.(int))) + dailyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &dailyScheduleObject } -func expandNetAppSnapshotPolicyWeeklySchedule(input []interface{}) *netapp.WeeklySchedule { +func expandNetAppSnapshotPolicyWeeklySchedule(input []interface{}) *snapshotpolicy.WeeklySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.WeeklySchedule{} + return &snapshotpolicy.WeeklySchedule{} } - weeklyScheduleObject := netapp.WeeklySchedule{} + weeklyScheduleObject := snapshotpolicy.WeeklySchedule{} weeklyScheduleRaw := input[0].(map[string]interface{}) if v, ok := weeklyScheduleRaw["snapshots_to_keep"]; ok { - weeklyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + weeklyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if _, ok := weeklyScheduleRaw["days_of_week"]; ok { weeklyScheduleObject.Day = utils.ExpandStringSliceWithDelimiter(weeklyScheduleRaw["days_of_week"].(*pluginsdk.Set).List(), ",") } if v, ok := weeklyScheduleRaw["hour"]; ok { - weeklyScheduleObject.Hour = utils.Int32(int32(v.(int))) + weeklyScheduleObject.Hour = utils.Int64(int64(v.(int))) } if v, ok := weeklyScheduleRaw["minute"]; ok { - weeklyScheduleObject.Minute = utils.Int32(int32(v.(int))) + weeklyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &weeklyScheduleObject } -func expandNetAppSnapshotPolicyMonthlySchedule(input []interface{}) *netapp.MonthlySchedule { +func expandNetAppSnapshotPolicyMonthlySchedule(input []interface{}) *snapshotpolicy.MonthlySchedule { if len(input) == 0 || input[0] == nil { - return &netapp.MonthlySchedule{} + return &snapshotpolicy.MonthlySchedule{} } - monthlyScheduleObject := netapp.MonthlySchedule{} + monthlyScheduleObject := snapshotpolicy.MonthlySchedule{} monthlyScheduleRaw := input[0].(map[string]interface{}) if v, ok := monthlyScheduleRaw["snapshots_to_keep"]; ok { - monthlyScheduleObject.SnapshotsToKeep = utils.Int32(int32(v.(int))) + monthlyScheduleObject.SnapshotsToKeep = utils.Int64(int64(v.(int))) } if _, ok := monthlyScheduleRaw["days_of_month"]; ok { monthlyScheduleObject.DaysOfMonth = utils.ExpandIntSliceWithDelimiter(monthlyScheduleRaw["days_of_month"].(*pluginsdk.Set).List(), ",") } if v, ok := monthlyScheduleRaw["hour"]; ok { - monthlyScheduleObject.Hour = utils.Int32(int32(v.(int))) + monthlyScheduleObject.Hour = utils.Int64(int64(v.(int))) } if v, ok := monthlyScheduleRaw["minute"]; ok { - monthlyScheduleObject.Minute = utils.Int32(int32(v.(int))) + monthlyScheduleObject.Minute = utils.Int64(int64(v.(int))) } return &monthlyScheduleObject } -func flattenNetAppVolumeSnapshotPolicyHourlySchedule(input *netapp.HourlySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyHourlySchedule(input *snapshotpolicy.HourlySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -486,7 +448,7 @@ func flattenNetAppVolumeSnapshotPolicyHourlySchedule(input *netapp.HourlySchedul } } -func flattenNetAppVolumeSnapshotPolicyDailySchedule(input *netapp.DailySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyDailySchedule(input *snapshotpolicy.DailySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -500,7 +462,7 @@ func flattenNetAppVolumeSnapshotPolicyDailySchedule(input *netapp.DailySchedule) } } -func flattenNetAppVolumeSnapshotPolicyWeeklySchedule(input *netapp.WeeklySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyWeeklySchedule(input *snapshotpolicy.WeeklySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -522,7 +484,7 @@ func flattenNetAppVolumeSnapshotPolicyWeeklySchedule(input *netapp.WeeklySchedul } } -func flattenNetAppVolumeSnapshotPolicyMonthlySchedule(input *netapp.MonthlySchedule) []interface{} { +func flattenNetAppVolumeSnapshotPolicyMonthlySchedule(input *snapshotpolicy.MonthlySchedule) []interface{} { if input == nil { return []interface{}{} } @@ -545,7 +507,7 @@ func flattenNetAppVolumeSnapshotPolicyMonthlySchedule(input *netapp.MonthlySched } } -func waitForSnapshotPolicyCreation(ctx context.Context, client *netapp.SnapshotPoliciesClient, id parse.SnapshotPolicyId, timeout time.Duration) error { +func waitForSnapshotPolicyCreation(ctx context.Context, client *snapshotpolicy.SnapshotPolicyClient, id snapshotpolicy.SnapshotPoliciesId, timeout time.Duration) error { stateConf := &pluginsdk.StateChangeConf{ ContinuousTargetOccurence: 5, Delay: 10 * time.Second, @@ -557,13 +519,13 @@ func waitForSnapshotPolicyCreation(ctx context.Context, client *netapp.SnapshotP } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting NetApp Volume Provisioning Service %q (Resource Group %q) to complete: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to complete: %+v", id, err) } return nil } -func waitForSnapshotPolicyDeletion(ctx context.Context, client *netapp.SnapshotPoliciesClient, id parse.SnapshotPolicyId, timeout time.Duration) error { +func waitForSnapshotPolicyDeletion(ctx context.Context, client *snapshotpolicy.SnapshotPolicyClient, id snapshotpolicy.SnapshotPoliciesId, timeout time.Duration) error { stateConf := &pluginsdk.StateChangeConf{ ContinuousTargetOccurence: 5, Delay: 10 * time.Second, @@ -575,21 +537,21 @@ func waitForSnapshotPolicyDeletion(ctx context.Context, client *netapp.SnapshotP } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for NetApp SnapshotPolicy Provisioning Service %q (Resource Group %q) to be deleted: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to be deleted: %+v", id, err) } return nil } -func netappSnapshotPolicyStateRefreshFunc(ctx context.Context, client *netapp.SnapshotPoliciesClient, id parse.SnapshotPolicyId) pluginsdk.StateRefreshFunc { +func netappSnapshotPolicyStateRefreshFunc(ctx context.Context, client *snapshotpolicy.SnapshotPolicyClient, id snapshotpolicy.SnapshotPoliciesId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + res, err := client.SnapshotPoliciesGet(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp SnapshotPolicy %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/internal/services/netapp/netapp_snapshot_policy_test.go b/internal/services/netapp/netapp_snapshot_policy_test.go index d6d654b6728d..e34eb0b19a71 100644 --- a/internal/services/netapp/netapp_snapshot_policy_test.go +++ b/internal/services/netapp/netapp_snapshot_policy_test.go @@ -5,10 +5,10 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -156,17 +156,17 @@ func TestAccNetAppSnapshotPolicy_complete(t *testing.T) { } func (t NetAppSnapshotPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.SnapshotPolicyID(state.ID) + id, err := snapshotpolicy.ParseSnapshotPoliciesID(state.ID) if err != nil { return nil, err } - resp, err := clients.NetApp.SnapshotPoliciesClient.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.Name) + resp, err := clients.NetApp.SnapshotPoliciesClient.SnapshotPoliciesGet(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Netapp SnapshotPolicy (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (NetAppSnapshotPolicyResource) basic(data acceptance.TestData) string { diff --git a/internal/services/netapp/netapp_snapshot_resource.go b/internal/services/netapp/netapp_snapshot_resource.go index 4c5f045af0fd..8ae77671d270 100644 --- a/internal/services/netapp/netapp_snapshot_resource.go +++ b/internal/services/netapp/netapp_snapshot_resource.go @@ -7,15 +7,14 @@ import ( "strconv" "time" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func resourceNetAppSnapshot() *pluginsdk.Resource { @@ -31,7 +30,7 @@ func resourceNetAppSnapshot() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(30 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.SnapshotID(id) + _, err := snapshots.ParseSnapshotID(id) return err }), @@ -77,32 +76,28 @@ func resourceNetAppSnapshotCreate(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForCreate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) + id := snapshots.NewSnapshotID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("volume_name").(string), d.Get("name").(string)) if d.IsNewResource() { - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + resp, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("checking for presence of %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(resp.Response) { + if !response.WasNotFound(resp.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_snapshot", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) - parameters := netapp.Snapshot{ - Location: utils.String(location), + parameters := snapshots.Snapshot{ + Location: location, } - future, err := client.Create(ctx, parameters, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) - if err != nil { + if err := client.CreateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for creation of %s: %+v", id, err) - } d.SetId(id.ID()) return resourceNetAppSnapshotRead(d, meta) @@ -113,28 +108,29 @@ func resourceNetAppSnapshotRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotID(d.Id()) + id, err := snapshots.ParseSnapshotID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] NetApp Snapshots %q does not exist - removing from state", d.Id()) d.SetId("") return nil } - return fmt.Errorf("reading NetApp Snapshots %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("reading %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - d.Set("pool_name", id.CapacityPoolName) + d.Set("name", id.SnapshotName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + d.Set("pool_name", id.PoolName) d.Set("volume_name", id.VolumeName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) } return nil @@ -145,13 +141,13 @@ func resourceNetAppSnapshotDelete(d *pluginsdk.ResourceData, meta interface{}) e ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.SnapshotID(d.Id()) + id, err := snapshots.ParseSnapshotID(d.Id()) if err != nil { return err } - if _, err = client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name); err != nil { - return fmt.Errorf("deleting NetApp Snapshot %q (Resource Group %q): %+v", id.Name, id.ResourceGroup, err) + if _, err = client.Delete(ctx, *id); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) } // The resource NetApp Snapshot depends on the resource NetApp Volume. @@ -159,33 +155,33 @@ func resourceNetAppSnapshotDelete(d *pluginsdk.ResourceData, meta interface{}) e // Then it tries to immediately delete NetApp Volume but it still throws error `Can not delete resource before nested resources are deleted.` // In this case we're going to re-check status code again. // For more details, see related Bug: https://github.com/Azure/azure-sdk-for-go/issues/11475 - log.Printf("[DEBUG] Waiting for NetApp Snapshot %q (Resource Group %q) to be deleted", id.Name, id.ResourceGroup) + log.Printf("[DEBUG] Waiting for %s to be deleted", id) stateConf := &pluginsdk.StateChangeConf{ ContinuousTargetOccurence: 5, Delay: 10 * time.Second, MinTimeout: 10 * time.Second, Pending: []string{"200", "202"}, Target: []string{"204", "404"}, - Refresh: netappSnapshotDeleteStateRefreshFunc(ctx, client, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name), + Refresh: netappSnapshotDeleteStateRefreshFunc(ctx, client, *id), Timeout: d.Timeout(pluginsdk.TimeoutDelete), } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for NetApp Snapshot %q (Resource Group %q) to be deleted: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for %s to be deleted: %+v", id, err) } return nil } -func netappSnapshotDeleteStateRefreshFunc(ctx context.Context, client *netapp.SnapshotsClient, resourceGroupName string, accountName string, poolName string, volumeName string, name string) pluginsdk.StateRefreshFunc { +func netappSnapshotDeleteStateRefreshFunc(ctx context.Context, client *snapshots.SnapshotsClient, id snapshots.SnapshotId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, resourceGroupName, accountName, poolName, volumeName, name) + res, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Snapshot %q (Resource Group %q): %s", name, resourceGroupName, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } diff --git a/internal/services/netapp/netapp_snapshot_resource_test.go b/internal/services/netapp/netapp_snapshot_resource_test.go index cc5c38821e19..2a5d329f6d93 100644 --- a/internal/services/netapp/netapp_snapshot_resource_test.go +++ b/internal/services/netapp/netapp_snapshot_resource_test.go @@ -5,10 +5,11 @@ import ( "fmt" "testing" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -64,17 +65,17 @@ func TestAccNetAppSnapshot_complete(t *testing.T) { } func (t NetAppSnapshotResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.SnapshotID(state.ID) + id, err := snapshots.ParseSnapshotID(state.ID) if err != nil { return nil, err } - resp, err := clients.NetApp.SnapshotClient.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) + resp, err := clients.NetApp.SnapshotClient.Get(ctx, *id) if err != nil { - return nil, fmt.Errorf("reading Netapp Snapshot (%s): %+v", id.String(), err) + return nil, fmt.Errorf("reading %s: %+v", id, err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (r NetAppSnapshotResource) basic(data acceptance.TestData) string { diff --git a/internal/services/netapp/netapp_volume_data_source.go b/internal/services/netapp/netapp_volume_data_source.go index 3d435a927dbd..b6413b4da7d5 100644 --- a/internal/services/netapp/netapp_volume_data_source.go +++ b/internal/services/netapp/netapp_volume_data_source.go @@ -4,14 +4,14 @@ import ( "fmt" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) func dataSourceNetAppVolume() *pluginsdk.Resource { @@ -123,10 +123,10 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + id := volumes.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) + resp, err := client.Get(ctx, id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { return fmt.Errorf("%s was not found", id) } return fmt.Errorf("retrieving %s: %+v", id, err) @@ -134,17 +134,18 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err d.SetId(id.ID()) - d.Set("name", id.Name) - d.Set("pool_name", id.CapacityPoolName) - d.Set("account_name", id.NetAppAccountName) - d.Set("resource_group_name", id.ResourceGroup) + d.Set("name", id.VolumeName) + d.Set("pool_name", id.PoolName) + d.Set("account_name", id.AccountName) + d.Set("resource_group_name", id.ResourceGroupName) - d.Set("location", location.NormalizeNilable(resp.Location)) + if model := resp.Model; model != nil { + d.Set("location", location.NormalizeNilable(&model.Location)) - if props := resp.VolumeProperties; props != nil { + props := model.Properties d.Set("volume_path", props.CreationToken) d.Set("service_level", props.ServiceLevel) - d.Set("subnet_id", props.SubnetID) + d.Set("subnet_id", props.SubnetId) d.Set("network_features", props.NetworkFeatures) protocolTypes := make([]string, 0) @@ -155,9 +156,7 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err d.Set("security_style", props.SecurityStyle) - if props.UsageThreshold != nil { - d.Set("storage_quota_in_gb", *props.UsageThreshold/1073741824) - } + d.Set("storage_quota_in_gb", props.UsageThreshold/1073741824) if err := d.Set("mount_ip_addresses", flattenNetAppVolumeMountIPAddresses(props.MountTargets)); err != nil { return fmt.Errorf("setting `mount_ip_addresses`: %+v", err) } diff --git a/internal/services/netapp/netapp_volume_resource.go b/internal/services/netapp/netapp_volume_resource.go index 7ddde3a07f49..1dbe6bec3111 100644 --- a/internal/services/netapp/netapp_volume_resource.go +++ b/internal/services/netapp/netapp_volume_resource.go @@ -8,16 +8,18 @@ import ( "strings" "time" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" - - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/helpers/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" - "github.com/hashicorp/terraform-provider-azurerm/internal/tags" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" "github.com/hashicorp/terraform-provider-azurerm/internal/timeouts" @@ -38,7 +40,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { Delete: pluginsdk.DefaultTimeout(60 * time.Minute), }, Importer: pluginsdk.ImporterValidatingResourceId(func(id string) error { - _, err := parse.VolumeID(id) + _, err := volumes.ParseVolumeID(id) return err }), @@ -80,9 +82,9 @@ func resourceNetAppVolume() *pluginsdk.Resource { Required: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.ServiceLevelPremium), - string(netapp.ServiceLevelStandard), - string(netapp.ServiceLevelUltra), + string(volumes.ServiceLevelPremium), + string(volumes.ServiceLevelStandard), + string(volumes.ServiceLevelUltra), }, false), }, @@ -98,7 +100,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { Optional: true, Computed: true, ForceNew: true, - ValidateFunc: netAppValidate.SnapshotID, + ValidateFunc: snapshots.ValidateSnapshotID, }, "network_features": { @@ -107,8 +109,8 @@ func resourceNetAppVolume() *pluginsdk.Resource { Computed: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{ - string(netapp.NetworkFeaturesBasic), - string(netapp.NetworkFeaturesStandard), + string(volumes.NetworkFeaturesBasic), + string(volumes.NetworkFeaturesStandard), }, false), }, @@ -206,7 +208,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { }, }, - "tags": tags.Schema(), + "tags": commonschema.Tags(), "mount_ip_addresses": { Type: pluginsdk.TypeList, @@ -283,28 +285,30 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id := parse.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) + id := volumes.NewVolumeID(subscriptionId, d.Get("resource_group_name").(string), d.Get("account_name").(string), d.Get("pool_name").(string), d.Get("name").(string)) if d.IsNewResource() { - existing, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + existing, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return fmt.Errorf("checking for presence of existing %s: %+v", id, err) } } - if !utils.ResponseWasNotFound(existing.Response) { + if !response.WasNotFound(existing.HttpResponse) { return tf.ImportAsExistsError("azurerm_netapp_volume", id.ID()) } } location := azure.NormalizeLocation(d.Get("location").(string)) volumePath := d.Get("volume_path").(string) - serviceLevel := d.Get("service_level").(string) + serviceLevel := volumes.ServiceLevel(d.Get("service_level").(string)) subnetID := d.Get("subnet_id").(string) - networkFeatures := d.Get("network_features").(string) - if networkFeatures == "" { - networkFeatures = string(netapp.NetworkFeaturesBasic) + var networkFeatures volumes.NetworkFeatures + networkFeaturesString := d.Get("network_features").(string) + if networkFeaturesString == "" { + networkFeatures = volumes.NetworkFeaturesBasic } + networkFeatures = volumes.NetworkFeatures(networkFeaturesString) protocols := d.Get("protocols").(*pluginsdk.Set).List() if len(protocols) == 0 { @@ -312,11 +316,11 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err } // Handling security style property - securityStyle := d.Get("security_style").(string) - if strings.EqualFold(securityStyle, "unix") && len(protocols) == 1 && strings.EqualFold(protocols[0].(string), "cifs") { + securityStyle := volumes.SecurityStyle(d.Get("security_style").(string)) + if strings.EqualFold(string(securityStyle), "unix") && len(protocols) == 1 && strings.EqualFold(protocols[0].(string), "cifs") { return fmt.Errorf("unix security style cannot be used in a CIFS enabled volume for %s", id) } - if strings.EqualFold(securityStyle, "ntfs") && len(protocols) == 1 && (strings.EqualFold(protocols[0].(string), "nfsv3") || strings.EqualFold(protocols[0].(string), "nfsv4.1")) { + if strings.EqualFold(string(securityStyle), "ntfs") && len(protocols) == 1 && (strings.EqualFold(protocols[0].(string), "nfsv3") || strings.EqualFold(protocols[0].(string), "nfsv4.1")) { return fmt.Errorf("ntfs security style cannot be used in a NFSv3/NFSv4.1 enabled volume for %s", id) } @@ -333,14 +337,20 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err authorizeReplication := false volumeType := "" - if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && strings.ToLower(string(dataProtectionReplication.Replication.EndpointType)) == "dst" { - authorizeReplication = true - volumeType = "DataProtection" + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { + endpointType := "" + if dataProtectionReplication.Replication.EndpointType != nil { + endpointType = string(*dataProtectionReplication.Replication.EndpointType) + } + if strings.ToLower(endpointType) == "dst" { + authorizeReplication = true + volumeType = "DataProtection" + } } // Validating that snapshot policies are not being created in a data protection volume if dataProtectionSnapshotPolicy.Snapshot != nil && volumeType != "" { - return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, NetApp Volume %q (Resource Group %q)", id.Name, id.ResourceGroup) + return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, NetApp Volume %q (Resource Group %q)", id.VolumeName, id.ResourceGroupName) } snapshotDirectoryVisible := d.Get("snapshot_directory_visible").(bool) @@ -350,82 +360,70 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err snapshotID := "" if snapshotResourceID != "" { // Get snapshot ID GUID value - parsedSnapshotResourceID, err := parse.SnapshotID(snapshotResourceID) + parsedSnapshotResourceID, err := snapshots.ParseSnapshotID(snapshotResourceID) if err != nil { return fmt.Errorf("parsing snapshotResourceID %q: %+v", snapshotResourceID, err) } snapshotClient := meta.(*clients.Client).NetApp.SnapshotClient - snapshotResponse, err := snapshotClient.Get( - ctx, - parsedSnapshotResourceID.ResourceGroup, - parsedSnapshotResourceID.NetAppAccountName, - parsedSnapshotResourceID.CapacityPoolName, - parsedSnapshotResourceID.VolumeName, - parsedSnapshotResourceID.Name, - ) + _, err = snapshotClient.Get(ctx, *parsedSnapshotResourceID) if err != nil { - return fmt.Errorf("getting snapshot from NetApp Volume %q (Resource Group %q): %+v", parsedSnapshotResourceID.VolumeName, parsedSnapshotResourceID.ResourceGroup, err) + return fmt.Errorf("getting snapshot from %s: %+v", id, err) } - snapshotID = *snapshotResponse.SnapshotID + sourceVolumeId := volumes.NewVolumeID(parsedSnapshotResourceID.SubscriptionId, parsedSnapshotResourceID.ResourceGroupName, parsedSnapshotResourceID.AccountName, parsedSnapshotResourceID.PoolName, parsedSnapshotResourceID.VolumeName) // Validate if properties that cannot be changed matches (protocols, subnet_id, location, resource group, account_name, pool_name, service_level) - sourceVolume, err := client.Get( - ctx, - parsedSnapshotResourceID.ResourceGroup, - parsedSnapshotResourceID.NetAppAccountName, - parsedSnapshotResourceID.CapacityPoolName, - parsedSnapshotResourceID.VolumeName, - ) + sourceVolume, err := client.Get(ctx, sourceVolumeId) if err != nil { - return fmt.Errorf("getting source NetApp Volume (snapshot's parent resource) %q (Resource Group %q): %+v", parsedSnapshotResourceID.VolumeName, parsedSnapshotResourceID.ResourceGroup, err) + return fmt.Errorf("getting source NetApp Volume (snapshot's parent resource) %q (Resource Group %q): %+v", parsedSnapshotResourceID.VolumeName, parsedSnapshotResourceID.ResourceGroupName, err) } - parsedVolumeID, err := parse.VolumeID(*sourceVolume.ID) - if err != nil { - return fmt.Errorf("parsing Source Volume ID: %s", err) - } propertyMismatch := []string{} - if !ValidateSlicesEquality(*sourceVolume.ProtocolTypes, *utils.ExpandStringSlice(protocols), false) { - propertyMismatch = append(propertyMismatch, "protocols") - } - if !strings.EqualFold(*sourceVolume.SubnetID, subnetID) { - propertyMismatch = append(propertyMismatch, "subnet_id") - } - if !strings.EqualFold(*sourceVolume.Location, location) { - propertyMismatch = append(propertyMismatch, "location") - } - if !strings.EqualFold(string(sourceVolume.ServiceLevel), serviceLevel) { - propertyMismatch = append(propertyMismatch, "service_level") - } - if !strings.EqualFold(parsedVolumeID.ResourceGroup, id.ResourceGroup) { - propertyMismatch = append(propertyMismatch, "resource_group_name") - } - if !strings.EqualFold(parsedVolumeID.NetAppAccountName, id.NetAppAccountName) { - propertyMismatch = append(propertyMismatch, "account_name") - } - if !strings.EqualFold(parsedVolumeID.CapacityPoolName, id.CapacityPoolName) { - propertyMismatch = append(propertyMismatch, "pool_name") - } - if len(propertyMismatch) > 0 { - return fmt.Errorf("following NetApp Volume properties on new Volume from Snapshot does not match Snapshot's source %s: %s", id, strings.Join(propertyMismatch, ", ")) + if model := sourceVolume.Model; model != nil { + props := model.Properties + if !ValidateSlicesEquality(*props.ProtocolTypes, *utils.ExpandStringSlice(protocols), false) { + propertyMismatch = append(propertyMismatch, "protocols") + } + if !strings.EqualFold(props.SubnetId, subnetID) { + propertyMismatch = append(propertyMismatch, "subnet_id") + } + if !strings.EqualFold(model.Location, location) { + propertyMismatch = append(propertyMismatch, "location") + } + if volumeServiceLevel := props.ServiceLevel; volumeServiceLevel != nil { + if !strings.EqualFold(string(*props.ServiceLevel), string(serviceLevel)) { + propertyMismatch = append(propertyMismatch, "service_level") + } + } + if !strings.EqualFold(sourceVolumeId.ResourceGroupName, id.ResourceGroupName) { + propertyMismatch = append(propertyMismatch, "resource_group_name") + } + if !strings.EqualFold(sourceVolumeId.AccountName, id.AccountName) { + propertyMismatch = append(propertyMismatch, "account_name") + } + if !strings.EqualFold(sourceVolumeId.PoolName, id.PoolName) { + propertyMismatch = append(propertyMismatch, "pool_name") + } + if len(propertyMismatch) > 0 { + return fmt.Errorf("following NetApp Volume properties on new Volume from Snapshot does not match Snapshot's source %s: %s", id, strings.Join(propertyMismatch, ", ")) + } } } - parameters := netapp.Volume{ - Location: utils.String(location), - VolumeProperties: &netapp.VolumeProperties{ - CreationToken: utils.String(volumePath), - ServiceLevel: netapp.ServiceLevel(serviceLevel), - SubnetID: utils.String(subnetID), - NetworkFeatures: netapp.NetworkFeatures(networkFeatures), + parameters := volumes.Volume{ + Location: location, + Properties: volumes.VolumeProperties{ + CreationToken: volumePath, + ServiceLevel: &serviceLevel, + SubnetId: subnetID, + NetworkFeatures: &networkFeatures, ProtocolTypes: utils.ExpandStringSlice(protocols), - SecurityStyle: netapp.SecurityStyle(securityStyle), - UsageThreshold: utils.Int64(storageQuotaInGB), + SecurityStyle: &securityStyle, + UsageThreshold: storageQuotaInGB, ExportPolicy: exportPolicyRule, VolumeType: utils.String(volumeType), - SnapshotID: utils.String(snapshotID), - DataProtection: &netapp.VolumePropertiesDataProtection{ + SnapshotId: utils.String(snapshotID), + DataProtection: &volumes.VolumePropertiesDataProtection{ Replication: dataProtectionReplication.Replication, Snapshot: dataProtectionSnapshotPolicy.Snapshot, }, @@ -435,16 +433,12 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err } if throughputMibps, ok := d.GetOk("throughput_in_mibps"); ok { - parameters.VolumeProperties.ThroughputMibps = utils.Float(throughputMibps.(float64)) + parameters.Properties.ThroughputMibps = utils.Float(throughputMibps.(float64)) } - future, err := client.CreateOrUpdate(ctx, parameters, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) - if err != nil { + if err := client.CreateOrUpdateThenPoll(ctx, id, parameters); err != nil { return fmt.Errorf("creating %s: %+v", id, err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the creation of %s: %+v", id, err) - } // Waiting for volume be completely provisioned if err := waitForVolumeCreateOrUpdate(ctx, client, id); err != nil { @@ -453,32 +447,22 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err // If this is a data replication secondary volume, authorize replication on primary volume if authorizeReplication { - replVolID, err := parse.VolumeID(*dataProtectionReplication.Replication.RemoteVolumeResourceID) + replicationClient := meta.(*clients.Client).NetApp.VolumeReplicationClient + replVolID, err := volumesreplication.ParseVolumeID(dataProtectionReplication.Replication.RemoteVolumeResourceId) if err != nil { return err } - future, err := client.AuthorizeReplication( - ctx, - replVolID.ResourceGroup, - replVolID.NetAppAccountName, - replVolID.CapacityPoolName, - replVolID.Name, - netapp.AuthorizeRequest{ - RemoteVolumeResourceID: utils.String(id.ID()), - }, - ) - if err != nil { + if err = replicationClient.VolumesAuthorizeReplicationThenPoll(ctx, *replVolID, volumesreplication.AuthorizeRequest{ + RemoteVolumeResourceId: utils.String(id.ID()), + }, + ); err != nil { return fmt.Errorf("cannot authorize volume replication: %v", err) } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("cannot get authorize volume replication future response: %v", err) - } - // Wait for volume replication authorization to complete - log.Printf("[DEBUG] Waiting for replication authorization on NetApp Volume Provisioning Service %q (Resource Group %q) to complete", id.Name, id.ResourceGroup) - if err := waitForReplAuthorization(ctx, client, id); err != nil { + log.Printf("[DEBUG] Waiting for replication authorization on %s to complete", id) + if err := waitForReplAuthorization(ctx, replicationClient, *replVolID); err != nil { return err } } @@ -493,27 +477,27 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForCreateUpdate(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VolumeID(d.Id()) + id, err := volumes.ParseVolumeID(d.Id()) if err != nil { return err } shouldUpdate := false - update := netapp.VolumePatch{ - VolumePatchProperties: &netapp.VolumePatchProperties{}, + update := volumes.VolumePatch{ + Properties: &volumes.VolumePatchProperties{}, } if d.HasChange("storage_quota_in_gb") { shouldUpdate = true storageQuotaInBytes := int64(d.Get("storage_quota_in_gb").(int) * 1073741824) - update.VolumePatchProperties.UsageThreshold = utils.Int64(storageQuotaInBytes) + update.Properties.UsageThreshold = utils.Int64(storageQuotaInBytes) } if d.HasChange("export_policy_rule") { shouldUpdate = true exportPolicyRuleRaw := d.Get("export_policy_rule").([]interface{}) exportPolicyRule := expandNetAppVolumeExportPolicyRulePatch(exportPolicyRuleRaw) - update.VolumePatchProperties.ExportPolicy = exportPolicyRule + update.Properties.ExportPolicy = exportPolicyRule } if d.HasChange("data_protection_snapshot_policy") { @@ -521,20 +505,20 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) - if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && strings.ToLower(string(dataProtectionReplication.Replication.EndpointType)) == "dst" { - return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, NetApp Volume %q (Resource Group %q)", id.Name, id.ResourceGroup) + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && dataProtectionReplication.Replication.EndpointType != nil && strings.ToLower(string(*dataProtectionReplication.Replication.EndpointType)) == "dst" { + return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, %s", id) } shouldUpdate = true dataProtectionSnapshotPolicyRaw := d.Get("data_protection_snapshot_policy").([]interface{}) dataProtectionSnapshotPolicy := expandNetAppVolumeDataProtectionSnapshotPolicyPatch(dataProtectionSnapshotPolicyRaw) - update.VolumePatchProperties.DataProtection = dataProtectionSnapshotPolicy + update.Properties.DataProtection = dataProtectionSnapshotPolicy } if d.HasChange("throughput_in_mibps") { shouldUpdate = true throughputMibps := d.Get("throughput_in_mibps") - update.VolumePatchProperties.ThroughputMibps = utils.Float(throughputMibps.(float64)) + update.Properties.ThroughputMibps = utils.Float(throughputMibps.(float64)) } if d.HasChange("tags") { @@ -544,12 +528,8 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err } if shouldUpdate { - future, err := client.Update(ctx, update, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) - if err != nil { - return fmt.Errorf("updating Volume %q: %+v", id.Name, err) - } - if err = future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the update of %s: %+v", id, err) + if err = client.UpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) } // Wait for volume to complete update @@ -566,14 +546,14 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error ctx, cancel := timeouts.ForRead(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VolumeID(d.Id()) + id, err := volumes.ParseVolumeID(d.Id()) if err != nil { return err } - resp, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + resp, err := client.Get(ctx, *id) if err != nil { - if utils.ResponseWasNotFound(resp.Response) { + if response.WasNotFound(resp.HttpResponse) { log.Printf("[INFO] %s was not found - removing from state", *id) d.SetId("") return nil @@ -581,25 +561,24 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error return fmt.Errorf("reading %s: %+v", *id, err) } - d.Set("name", id.Name) - d.Set("resource_group_name", id.ResourceGroup) - d.Set("account_name", id.NetAppAccountName) - d.Set("pool_name", id.CapacityPoolName) - if location := resp.Location; location != nil { - d.Set("location", azure.NormalizeLocation(*location)) - } - if props := resp.VolumeProperties; props != nil { + d.Set("name", id.VolumeName) + d.Set("resource_group_name", id.ResourceGroupName) + d.Set("account_name", id.AccountName) + d.Set("pool_name", id.PoolName) + + if model := resp.Model; model != nil { + d.Set("location", azure.NormalizeLocation(model.Location)) + + props := model.Properties d.Set("volume_path", props.CreationToken) d.Set("service_level", props.ServiceLevel) - d.Set("subnet_id", props.SubnetID) + d.Set("subnet_id", props.SubnetId) d.Set("network_features", props.NetworkFeatures) d.Set("protocols", props.ProtocolTypes) d.Set("security_style", props.SecurityStyle) d.Set("snapshot_directory_visible", props.SnapshotDirectoryVisible) d.Set("throughput_in_mibps", props.ThroughputMibps) - if props.UsageThreshold != nil { - d.Set("storage_quota_in_gb", *props.UsageThreshold/1073741824) - } + d.Set("storage_quota_in_gb", props.UsageThreshold/1073741824) if err := d.Set("export_policy_rule", flattenNetAppVolumeExportPolicyRule(props.ExportPolicy)); err != nil { return fmt.Errorf("setting `export_policy_rule`: %+v", err) } @@ -612,9 +591,10 @@ func resourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) error if err := d.Set("data_protection_snapshot_policy", flattenNetAppVolumeDataProtectionSnapshotPolicy(props.DataProtection)); err != nil { return fmt.Errorf("setting `data_protection_snapshot_policy`: %+v", err) } - } - return tags.FlattenAndSet(d, resp.Tags) + return tags.FlattenAndSet(d, model.Tags) + } + return nil } func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) error { @@ -622,7 +602,7 @@ func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) err ctx, cancel := timeouts.ForDelete(meta.(*clients.Client).StopContext, d) defer cancel() - id, err := parse.VolumeID(d.Id()) + id, err := volumes.ParseVolumeID(d.Id()) if err != nil { return err } @@ -631,82 +611,70 @@ func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) err dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) - if replicaVolumeId := id; dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { - if dataProtectionReplication.Replication.RemoteVolumeResourceID == nil { - return fmt.Errorf("remote volume id was nil") + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { + replicaVolumeId, err := volumesreplication.ParseVolumeID(id.ID()) + if err != nil { + return err } - - if strings.ToLower(string(dataProtectionReplication.Replication.EndpointType)) != "dst" { + if dataProtectionReplication.Replication.EndpointType != nil && strings.ToLower(string(*dataProtectionReplication.Replication.EndpointType)) != "dst" { // This is the case where primary volume started the deletion, in this case, to be consistent we will remove replication from secondary - replicaVolumeId, err = parse.VolumeID(*dataProtectionReplication.Replication.RemoteVolumeResourceID) + replicaVolumeId, err = volumesreplication.ParseVolumeID(dataProtectionReplication.Replication.RemoteVolumeResourceId) if err != nil { return err } } + replicationClient := meta.(*clients.Client).NetApp.VolumeReplicationClient // Checking replication status before deletion, it need to be broken before proceeding with deletion - if res, err := client.ReplicationStatusMethod(ctx, replicaVolumeId.ResourceGroup, replicaVolumeId.NetAppAccountName, replicaVolumeId.CapacityPoolName, replicaVolumeId.Name); err == nil { + if res, err := replicationClient.VolumesReplicationStatus(ctx, *replicaVolumeId); err == nil { // Wait for replication state = "mirrored" - if strings.ToLower(string(res.MirrorState)) == "uninitialized" { - if err := waitForReplMirrorState(ctx, client, *replicaVolumeId, "mirrored"); err != nil { - return fmt.Errorf("waiting for replica %s to become 'mirrored': %+v", *replicaVolumeId, err) + if model := res.Model; model != nil { + if model.MirrorState != nil && strings.ToLower(string(*model.MirrorState)) == "uninitialized" { + if err := waitForReplMirrorState(ctx, replicationClient, *replicaVolumeId, "mirrored"); err != nil { + return fmt.Errorf("waiting for replica %s to become 'mirrored': %+v", *replicaVolumeId, err) + } } } // Breaking replication - _, err = client.BreakReplication(ctx, - replicaVolumeId.ResourceGroup, - replicaVolumeId.NetAppAccountName, - replicaVolumeId.CapacityPoolName, - replicaVolumeId.Name, - &netapp.BreakReplicationRequest{ - ForceBreakReplication: utils.Bool(true), - }) - - if err != nil { + if err = replicationClient.VolumesBreakReplicationThenPoll(ctx, *replicaVolumeId, volumesreplication.BreakReplicationRequest{ + ForceBreakReplication: utils.Bool(true), + }); err != nil { return fmt.Errorf("breaking replication for %s: %+v", *replicaVolumeId, err) } // Waiting for replication be in broken state log.Printf("[DEBUG] Waiting for the replication of %s to be in broken state", *replicaVolumeId) - if err := waitForReplMirrorState(ctx, client, *replicaVolumeId, "broken"); err != nil { + if err := waitForReplMirrorState(ctx, replicationClient, *replicaVolumeId, "broken"); err != nil { return fmt.Errorf("waiting for the breaking of replication for %s: %+v", *replicaVolumeId, err) } } // Deleting replication and waiting for it to fully complete the operation - future, err := client.DeleteReplication(ctx, replicaVolumeId.ResourceGroup, replicaVolumeId.NetAppAccountName, replicaVolumeId.CapacityPoolName, replicaVolumeId.Name) - if err != nil { + if err = replicationClient.VolumesDeleteReplicationThenPoll(ctx, *replicaVolumeId); err != nil { return fmt.Errorf("deleting replicate %s: %+v", *replicaVolumeId, err) } - log.Printf("[DEBUG] Waiting for the replica of %s to be deleted", replicaVolumeId) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for the replica %s to be deleted: %+v", *replicaVolumeId, err) - } - if err := waitForReplicationDeletion(ctx, client, *replicaVolumeId); err != nil { + if err := waitForReplicationDeletion(ctx, replicationClient, *replicaVolumeId); err != nil { return fmt.Errorf("waiting for the replica %s to be deleted: %+v", *replicaVolumeId, err) } } // Deleting volume and waiting for it fo fully complete the operation - future, err := client.Delete(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name, utils.Bool(true)) - if err != nil { + if err = client.DeleteThenPoll(ctx, *id, volumes.DeleteOperationOptions{ + ForceDelete: utils.Bool(true), + }); err != nil { return fmt.Errorf("deleting %s: %+v", *id, err) } - log.Printf("[DEBUG] Waiting for %s to be deleted", *id) - if err := future.WaitForCompletionRef(ctx, client.Client); err != nil { - return fmt.Errorf("waiting for deletion of %q: %+v", id, err) - } - if err := waitForVolumeDeletion(ctx, client, *id); err != nil { + if err = waitForVolumeDeletion(ctx, client, *id); err != nil { return fmt.Errorf("waiting for deletion of %s: %+v", *id, err) } return nil } -func waitForVolumeCreateOrUpdate(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForVolumeCreateOrUpdate(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -728,7 +696,7 @@ func waitForVolumeCreateOrUpdate(ctx context.Context, client *netapp.VolumesClie return nil } -func waitForReplAuthorization(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForReplAuthorization(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -744,13 +712,13 @@ func waitForReplAuthorization(ctx context.Context, client *netapp.VolumesClient, } if _, err := stateConf.WaitForStateContext(ctx); err != nil { - return fmt.Errorf("waiting for replication authorization NetApp Volume Provisioning Service %q (Resource Group %q) to complete: %+v", id.Name, id.ResourceGroup, err) + return fmt.Errorf("waiting for replication authorization %s to complete: %+v", id, err) } return nil } -func waitForReplMirrorState(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId, desiredState string) error { +func waitForReplMirrorState(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId, desiredState string) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -772,7 +740,7 @@ func waitForReplMirrorState(ctx context.Context, client *netapp.VolumesClient, i return nil } -func waitForReplicationDeletion(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForReplicationDeletion(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -795,7 +763,7 @@ func waitForReplicationDeletion(ctx context.Context, client *netapp.VolumesClien return nil } -func waitForVolumeDeletion(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) error { +func waitForVolumeDeletion(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) error { deadline, ok := ctx.Deadline() if !ok { return fmt.Errorf("context had no deadline") @@ -817,40 +785,40 @@ func waitForVolumeDeletion(ctx context.Context, client *netapp.VolumesClient, id return nil } -func netappVolumeStateRefreshFunc(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) pluginsdk.StateRefreshFunc { +func netappVolumeStateRefreshFunc(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + res, err := client.Get(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving NetApp Volume %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } -func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId, desiredState string) pluginsdk.StateRefreshFunc { +func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId, desiredState string) pluginsdk.StateRefreshFunc { validStates := []string{"mirrored", "broken", "uninitialized"} return func() (interface{}, string, error) { // Possible Mirror States to be used as desiredStates: // mirrored, broken or uninitialized if !utils.SliceContainsValue(validStates, strings.ToLower(desiredState)) { - return nil, "", fmt.Errorf("Invalid desired mirror state was passed to check mirror replication state (%s), possible values: (%+v)", desiredState, netapp.PossibleMirrorStateValues()) + return nil, "", fmt.Errorf("Invalid desired mirror state was passed to check mirror replication state (%s), possible values: (%+v)", desiredState, volumesreplication.PossibleValuesForMirrorState()) } - res, err := client.ReplicationStatusMethod(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + res, err := client.VolumesReplicationStatus(ctx, id) if err != nil { - if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving replication status information from NetApp Volume %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving replication status information from %s: %s", id, err) } } // TODO: fix this refresh function to use strings instead of fake status codes // Setting 200 as default response response := 200 - if strings.EqualFold(string(res.MirrorState), desiredState) { + if res.Model != nil && res.Model.MirrorState != nil && strings.EqualFold(string(*res.Model.MirrorState), desiredState) { // return 204 if state matches desired state response = 204 } @@ -859,28 +827,30 @@ func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client * } } -func netappVolumeReplicationStateRefreshFunc(ctx context.Context, client *netapp.VolumesClient, id parse.VolumeId) pluginsdk.StateRefreshFunc { +func netappVolumeReplicationStateRefreshFunc(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { - res, err := client.ReplicationStatusMethod(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + res, err := client.VolumesReplicationStatus(ctx, id) if err != nil { - if res.StatusCode == 400 && (strings.Contains(strings.ToLower(err.Error()), "deleting") || strings.Contains(strings.ToLower(err.Error()), "volume replication missing or deleted")) { - // This error can be ignored until a bug is fixed on RP side that it is returning 400 while the replication is in "Deleting" process - // TODO: remove this workaround when above bug is fixed - } else if !utils.ResponseWasNotFound(res.Response) { - return nil, "", fmt.Errorf("retrieving replication status from NetApp Volume %q (Resource Group %q): %s", id.Name, id.ResourceGroup, err) + if httpResponse := res.HttpResponse; httpResponse != nil { + if httpResponse.StatusCode == 400 && (strings.Contains(strings.ToLower(err.Error()), "deleting") || strings.Contains(strings.ToLower(err.Error()), "volume replication missing or deleted")) { + // This error can be ignored until a bug is fixed on RP side that it is returning 400 while the replication is in "Deleting" process + // TODO: remove this workaround when above bug is fixed + } else if !response.WasNotFound(httpResponse) { + return nil, "", fmt.Errorf("retrieving replication status from %s: %s", id, err) + } } } - return res, strconv.Itoa(res.StatusCode), nil + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil } } -func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePropertiesExportPolicy { - results := make([]netapp.ExportPolicyRule, 0) +func expandNetAppVolumeExportPolicyRule(input []interface{}) *volumes.VolumePropertiesExportPolicy { + results := make([]volumes.ExportPolicyRule, 0) for _, item := range input { if item != nil { v := item.(map[string]interface{}) - ruleIndex := int32(v["rule_index"].(int)) + ruleIndex := int64(v["rule_index"].(int)) allowedClients := strings.Join(*utils.ExpandStringSlice(v["allowed_clients"].(*pluginsdk.Set).List()), ",") cifsEnabled := false @@ -909,12 +879,12 @@ func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePrope unixReadWrite := v["unix_read_write"].(bool) rootAccessEnabled := v["root_access_enabled"].(bool) - result := netapp.ExportPolicyRule{ + result := volumes.ExportPolicyRule{ AllowedClients: utils.String(allowedClients), Cifs: utils.Bool(cifsEnabled), Nfsv3: utils.Bool(nfsv3Enabled), Nfsv41: utils.Bool(nfsv41Enabled), - RuleIndex: utils.Int32(ruleIndex), + RuleIndex: utils.Int64(ruleIndex), UnixReadOnly: utils.Bool(unixReadOnly), UnixReadWrite: utils.Bool(unixReadWrite), HasRootAccess: utils.Bool(rootAccessEnabled), @@ -924,17 +894,17 @@ func expandNetAppVolumeExportPolicyRule(input []interface{}) *netapp.VolumePrope } } - return &netapp.VolumePropertiesExportPolicy{ + return &volumes.VolumePropertiesExportPolicy{ Rules: &results, } } -func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *netapp.VolumePatchPropertiesExportPolicy { - results := make([]netapp.ExportPolicyRule, 0) +func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *volumes.VolumePatchPropertiesExportPolicy { + results := make([]volumes.ExportPolicyRule, 0) for _, item := range input { if item != nil { v := item.(map[string]interface{}) - ruleIndex := int32(v["rule_index"].(int)) + ruleIndex := int64(v["rule_index"].(int)) allowedClients := strings.Join(*utils.ExpandStringSlice(v["allowed_clients"].(*pluginsdk.Set).List()), ",") cifsEnabled := false @@ -963,12 +933,12 @@ func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *netapp.Volume unixReadWrite := v["unix_read_write"].(bool) rootAccessEnabled := v["root_access_enabled"].(bool) - result := netapp.ExportPolicyRule{ + result := volumes.ExportPolicyRule{ AllowedClients: utils.String(allowedClients), Cifs: utils.Bool(cifsEnabled), Nfsv3: utils.Bool(nfsv3Enabled), Nfsv41: utils.Bool(nfsv41Enabled), - RuleIndex: utils.Int32(ruleIndex), + RuleIndex: utils.Int64(ruleIndex), UnixReadOnly: utils.Bool(unixReadOnly), UnixReadWrite: utils.Bool(unixReadWrite), HasRootAccess: utils.Bool(rootAccessEnabled), @@ -978,82 +948,84 @@ func expandNetAppVolumeExportPolicyRulePatch(input []interface{}) *netapp.Volume } } - return &netapp.VolumePatchPropertiesExportPolicy{ + return &volumes.VolumePatchPropertiesExportPolicy{ Rules: &results, } } -func expandNetAppVolumeDataProtectionReplication(input []interface{}) *netapp.VolumePropertiesDataProtection { +func expandNetAppVolumeDataProtectionReplication(input []interface{}) *volumes.VolumePropertiesDataProtection { if len(input) == 0 || input[0] == nil { - return &netapp.VolumePropertiesDataProtection{} + return &volumes.VolumePropertiesDataProtection{} } - replicationObject := netapp.ReplicationObject{} + replicationObject := volumes.ReplicationObject{} replicationRaw := input[0].(map[string]interface{}) if v, ok := replicationRaw["endpoint_type"]; ok { - replicationObject.EndpointType = netapp.EndpointType(v.(string)) + endpointType := volumes.EndpointType(v.(string)) + replicationObject.EndpointType = &endpointType } if v, ok := replicationRaw["remote_volume_location"]; ok { replicationObject.RemoteVolumeRegion = utils.String(v.(string)) } if v, ok := replicationRaw["remote_volume_resource_id"]; ok { - replicationObject.RemoteVolumeResourceID = utils.String(v.(string)) + replicationObject.RemoteVolumeResourceId = v.(string) } if v, ok := replicationRaw["replication_frequency"]; ok { - replicationObject.ReplicationSchedule = netapp.ReplicationSchedule(translateTFSchedule(v.(string))) + replicationSchedule := volumes.ReplicationSchedule(translateTFSchedule(v.(string))) + replicationObject.ReplicationSchedule = &replicationSchedule } - return &netapp.VolumePropertiesDataProtection{ + return &volumes.VolumePropertiesDataProtection{ Replication: &replicationObject, } } -func expandNetAppVolumeDataProtectionSnapshotPolicy(input []interface{}) *netapp.VolumePropertiesDataProtection { +func expandNetAppVolumeDataProtectionSnapshotPolicy(input []interface{}) *volumes.VolumePropertiesDataProtection { if len(input) == 0 || input[0] == nil { - return &netapp.VolumePropertiesDataProtection{} + return &volumes.VolumePropertiesDataProtection{} } - snapshotObject := netapp.VolumeSnapshotProperties{} + snapshotObject := volumes.VolumeSnapshotProperties{} snapshotRaw := input[0].(map[string]interface{}) if v, ok := snapshotRaw["snapshot_policy_id"]; ok { - snapshotObject.SnapshotPolicyID = utils.String(v.(string)) + snapshotObject.SnapshotPolicyId = utils.String(v.(string)) } - return &netapp.VolumePropertiesDataProtection{ + return &volumes.VolumePropertiesDataProtection{ Snapshot: &snapshotObject, } } -func expandNetAppVolumeDataProtectionSnapshotPolicyPatch(input []interface{}) *netapp.VolumePatchPropertiesDataProtection { +func expandNetAppVolumeDataProtectionSnapshotPolicyPatch(input []interface{}) *volumes.VolumePatchPropertiesDataProtection { if len(input) == 0 || input[0] == nil { - return &netapp.VolumePatchPropertiesDataProtection{} + return &volumes.VolumePatchPropertiesDataProtection{} } - snapshotObject := netapp.VolumeSnapshotProperties{} + snapshotObject := volumes.VolumeSnapshotProperties{} snapshotRaw := input[0].(map[string]interface{}) if v, ok := snapshotRaw["snapshot_policy_id"]; ok { - snapshotObject.SnapshotPolicyID = utils.String(v.(string)) + snapshotObject.SnapshotPolicyId = utils.String(v.(string)) } - return &netapp.VolumePatchPropertiesDataProtection{ + return &volumes.VolumePatchPropertiesDataProtection{ Snapshot: &snapshotObject, } } -func flattenNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExportPolicy) []interface{} { +func flattenNetAppVolumeExportPolicyRule(input *volumes.VolumePropertiesExportPolicy) []interface{} { results := make([]interface{}, 0) if input == nil || input.Rules == nil { return results } for _, item := range *input.Rules { - ruleIndex := int32(0) + ruleIndex := int64(0) if v := item.RuleIndex; v != nil { ruleIndex = *v } @@ -1105,48 +1077,53 @@ func flattenNetAppVolumeExportPolicyRule(input *netapp.VolumePropertiesExportPol return results } -func flattenNetAppVolumeMountIPAddresses(input *[]netapp.MountTargetProperties) []interface{} { +func flattenNetAppVolumeMountIPAddresses(input *[]volumes.MountTargetProperties) []interface{} { results := make([]interface{}, 0) if input == nil { return results } for _, item := range *input { - if item.IPAddress != nil { - results = append(results, item.IPAddress) + if item.IpAddress != nil { + results = append(results, item.IpAddress) } } return results } -func flattenNetAppVolumeDataProtectionReplication(input *netapp.VolumePropertiesDataProtection) []interface{} { - if input == nil || input.Replication == nil { +func flattenNetAppVolumeDataProtectionReplication(input *volumes.VolumePropertiesDataProtection) []interface{} { + if input == nil || input.Replication == nil || input.Replication.EndpointType == nil { return []interface{}{} } - if strings.ToLower(string(input.Replication.EndpointType)) == "" || strings.ToLower(string(input.Replication.EndpointType)) != "dst" { + if strings.ToLower(string(*input.Replication.EndpointType)) == "" || strings.ToLower(string(*input.Replication.EndpointType)) != "dst" { return []interface{}{} } + replicationFrequency := "" + if input.Replication.ReplicationSchedule != nil { + replicationFrequency = translateSDKSchedule(strings.ToLower(string(*input.Replication.ReplicationSchedule))) + } + return []interface{}{ map[string]interface{}{ - "endpoint_type": strings.ToLower(string(input.Replication.EndpointType)), + "endpoint_type": strings.ToLower(string(*input.Replication.EndpointType)), "remote_volume_location": location.NormalizeNilable(input.Replication.RemoteVolumeRegion), - "remote_volume_resource_id": input.Replication.RemoteVolumeResourceID, - "replication_frequency": translateSDKSchedule(strings.ToLower(string(input.Replication.ReplicationSchedule))), + "remote_volume_resource_id": input.Replication.RemoteVolumeResourceId, + "replication_frequency": replicationFrequency, }, } } -func flattenNetAppVolumeDataProtectionSnapshotPolicy(input *netapp.VolumePropertiesDataProtection) []interface{} { +func flattenNetAppVolumeDataProtectionSnapshotPolicy(input *volumes.VolumePropertiesDataProtection) []interface{} { if input == nil || input.Snapshot == nil { return []interface{}{} } return []interface{}{ map[string]interface{}{ - "snapshot_policy_id": input.Snapshot.SnapshotPolicyID, + "snapshot_policy_id": input.Snapshot.SnapshotPolicyId, }, } } diff --git a/internal/services/netapp/netapp_volume_resource_test.go b/internal/services/netapp/netapp_volume_resource_test.go index 336a36cba8ba..24f7f4db9894 100644 --- a/internal/services/netapp/netapp_volume_resource_test.go +++ b/internal/services/netapp/netapp_volume_resource_test.go @@ -6,11 +6,10 @@ import ( "os" "testing" - "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/utils" ) @@ -41,7 +40,7 @@ func TestAccNetAppVolume_nfsv41(t *testing.T) { Config: r.nfsv41(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("network_features").HasValue(string(netapp.NetworkFeaturesBasic)), + check.That(data.ResourceName).Key("network_features").HasValue(string(volumes.NetworkFeaturesBasic)), ), }, data.ImportStep(), @@ -57,7 +56,7 @@ func TestAccNetAppVolume_standardNetworkFeature(t *testing.T) { Config: r.standardNetworkFeature(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("network_features").HasValue(string(netapp.NetworkFeaturesStandard)), + check.That(data.ResourceName).Key("network_features").HasValue(string(volumes.NetworkFeaturesStandard)), ), }, data.ImportStep(), @@ -257,17 +256,17 @@ func TestAccNetAppVolume_updateExportPolicyRule(t *testing.T) { } func (t NetAppVolumeResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { - id, err := parse.VolumeID(state.ID) + id, err := volumes.ParseVolumeID(state.ID) if err != nil { return nil, err } - resp, err := clients.NetApp.VolumeClient.Get(ctx, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) + resp, err := clients.NetApp.VolumeClient.Get(ctx, *id) if err != nil { return nil, fmt.Errorf("reading Netapp Volume (%s): %+v", id.String(), err) } - return utils.Bool(resp.ID != nil), nil + return utils.Bool(resp.Model != nil), nil } func (NetAppVolumeResource) basic(data acceptance.TestData) string { diff --git a/internal/services/netapp/parse/account.go b/internal/services/netapp/parse/account.go deleted file mode 100644 index bdda02573d66..000000000000 --- a/internal/services/netapp/parse/account.go +++ /dev/null @@ -1,69 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type AccountId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string -} - -func NewAccountID(subscriptionId, resourceGroup, netAppAccountName string) AccountId { - return AccountId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - } -} - -func (id AccountId) String() string { - segments := []string{ - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Account", segmentsStr) -} - -func (id AccountId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName) -} - -// AccountID parses a Account ID into an AccountId struct -func AccountID(input string) (*AccountId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := AccountId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/netapp/parse/account_test.go b/internal/services/netapp/parse/account_test.go deleted file mode 100644 index 739a002f8433..000000000000 --- a/internal/services/netapp/parse/account_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = AccountId{} - -func TestAccountIDFormatter(t *testing.T) { - actual := NewAccountID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Error: true, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1", - Expected: &AccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - NetAppAccountName: "account1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := AccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - } -} diff --git a/internal/services/netapp/parse/capacity_pool.go b/internal/services/netapp/parse/capacity_pool.go deleted file mode 100644 index 21aaba804444..000000000000 --- a/internal/services/netapp/parse/capacity_pool.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CapacityPoolId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - Name string -} - -func NewCapacityPoolID(subscriptionId, resourceGroup, netAppAccountName, name string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - Name: name, - } -} - -func (id CapacityPoolId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Capacity Pool", segmentsStr) -} - -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.Name) -} - -// CapacityPoolID parses a CapacityPool ID into an CapacityPoolId struct -func CapacityPoolID(input string) (*CapacityPoolId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := CapacityPoolId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("capacityPools"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/netapp/parse/capacity_pool_test.go b/internal/services/netapp/parse/capacity_pool_test.go deleted file mode 100644 index be11aa3ad12e..000000000000 --- a/internal/services/netapp/parse/capacity_pool_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = CapacityPoolId{} - -func TestCapacityPoolIDFormatter(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "pool1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Error: true, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - NetAppAccountName: "account1", - Name: "pool1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/CAPACITYPOOLS/POOL1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := CapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/netapp/parse/snapshot.go b/internal/services/netapp/parse/snapshot.go deleted file mode 100644 index a12d38e21aae..000000000000 --- a/internal/services/netapp/parse/snapshot.go +++ /dev/null @@ -1,87 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SnapshotId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - CapacityPoolName string - VolumeName string - Name string -} - -func NewSnapshotID(subscriptionId, resourceGroup, netAppAccountName, capacityPoolName, volumeName, name string) SnapshotId { - return SnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - Name: name, - } -} - -func (id SnapshotId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Volume Name %q", id.VolumeName), - fmt.Sprintf("Capacity Pool Name %q", id.CapacityPoolName), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Snapshot", segmentsStr) -} - -func (id SnapshotId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.Name) -} - -// SnapshotID parses a Snapshot ID into an SnapshotId struct -func SnapshotID(input string) (*SnapshotId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SnapshotId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.CapacityPoolName, err = id.PopSegment("capacityPools"); err != nil { - return nil, err - } - if resourceId.VolumeName, err = id.PopSegment("volumes"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("snapshots"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/netapp/parse/snapshot_policy.go b/internal/services/netapp/parse/snapshot_policy.go deleted file mode 100644 index 17de0f50ed18..000000000000 --- a/internal/services/netapp/parse/snapshot_policy.go +++ /dev/null @@ -1,75 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - Name string -} - -func NewSnapshotPolicyID(subscriptionId, resourceGroup, netAppAccountName, name string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - Name: name, - } -} - -func (id SnapshotPolicyId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Snapshot Policy", segmentsStr) -} - -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.Name) -} - -// SnapshotPolicyID parses a SnapshotPolicy ID into an SnapshotPolicyId struct -func SnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := SnapshotPolicyId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("snapshotPolicies"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/netapp/parse/snapshot_policy_test.go b/internal/services/netapp/parse/snapshot_policy_test.go deleted file mode 100644 index d4f2cc8179fe..000000000000 --- a/internal/services/netapp/parse/snapshot_policy_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = SnapshotPolicyId{} - -func TestSnapshotPolicyIDFormatter(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "snapshotpolicy1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Error: true, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - NetAppAccountName: "account1", - Name: "snapshotpolicy1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/SNAPSHOTPOLICIES/SNAPSHOTPOLICY1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := SnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/netapp/parse/snapshot_test.go b/internal/services/netapp/parse/snapshot_test.go deleted file mode 100644 index f4f3810bca32..000000000000 --- a/internal/services/netapp/parse/snapshot_test.go +++ /dev/null @@ -1,160 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = SnapshotId{} - -func TestSnapshotIDFormatter(t *testing.T) { - actual := NewSnapshotID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "pool1", "volume1", "snapshot1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestSnapshotID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Error: true, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Error: true, - }, - - { - // missing CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Error: true, - }, - - { - // missing value for CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/", - Error: true, - }, - - { - // missing VolumeName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/", - Error: true, - }, - - { - // missing value for VolumeName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - NetAppAccountName: "account1", - CapacityPoolName: "pool1", - VolumeName: "volume1", - Name: "snapshot1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/CAPACITYPOOLS/POOL1/VOLUMES/VOLUME1/SNAPSHOTS/SNAPSHOT1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := SnapshotID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/netapp/parse/volume.go b/internal/services/netapp/parse/volume.go deleted file mode 100644 index 30029b460d56..000000000000 --- a/internal/services/netapp/parse/volume.go +++ /dev/null @@ -1,81 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type VolumeId struct { - SubscriptionId string - ResourceGroup string - NetAppAccountName string - CapacityPoolName string - Name string -} - -func NewVolumeID(subscriptionId, resourceGroup, netAppAccountName, capacityPoolName, name string) VolumeId { - return VolumeId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - Name: name, - } -} - -func (id VolumeId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Capacity Pool Name %q", id.CapacityPoolName), - fmt.Sprintf("Net App Account Name %q", id.NetAppAccountName), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Volume", segmentsStr) -} - -func (id VolumeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.NetAppAccountName, id.CapacityPoolName, id.Name) -} - -// VolumeID parses a Volume ID into an VolumeId struct -func VolumeID(input string) (*VolumeId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, err - } - - resourceId := VolumeId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.NetAppAccountName, err = id.PopSegment("netAppAccounts"); err != nil { - return nil, err - } - if resourceId.CapacityPoolName, err = id.PopSegment("capacityPools"); err != nil { - return nil, err - } - if resourceId.Name, err = id.PopSegment("volumes"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/netapp/parse/volume_test.go b/internal/services/netapp/parse/volume_test.go deleted file mode 100644 index a5834d71ffa5..000000000000 --- a/internal/services/netapp/parse/volume_test.go +++ /dev/null @@ -1,144 +0,0 @@ -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = VolumeId{} - -func TestVolumeIDFormatter(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "resGroup1", "account1", "pool1", "volume1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Error: true, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Error: true, - }, - - { - // missing CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Error: true, - }, - - { - // missing value for CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - NetAppAccountName: "account1", - CapacityPoolName: "pool1", - Name: "volume1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/CAPACITYPOOLS/POOL1/VOLUMES/VOLUME1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := VolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/netapp/resourceids.go b/internal/services/netapp/resourceids.go deleted file mode 100644 index 327b574023b5..000000000000 --- a/internal/services/netapp/resourceids.go +++ /dev/null @@ -1,7 +0,0 @@ -package netapp - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Account -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CapacityPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Snapshot -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=SnapshotPolicy -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1 -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=Volume -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1 diff --git a/internal/services/netapp/validate/account_id.go b/internal/services/netapp/validate/account_id.go deleted file mode 100644 index 9ad84a7c705c..000000000000 --- a/internal/services/netapp/validate/account_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func AccountID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.AccountID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/netapp/validate/account_id_test.go b/internal/services/netapp/validate/account_id_test.go deleted file mode 100644 index 04818b2b4332..000000000000 --- a/internal/services/netapp/validate/account_id_test.go +++ /dev/null @@ -1,76 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestAccountID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Valid: false, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := AccountID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/netapp/validate/capacity_pool_id.go b/internal/services/netapp/validate/capacity_pool_id.go deleted file mode 100644 index 461352e31b25..000000000000 --- a/internal/services/netapp/validate/capacity_pool_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func CapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/netapp/validate/capacity_pool_id_test.go b/internal/services/netapp/validate/capacity_pool_id_test.go deleted file mode 100644 index 4a79bf964c36..000000000000 --- a/internal/services/netapp/validate/capacity_pool_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestCapacityPoolID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Valid: false, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/CAPACITYPOOLS/POOL1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := CapacityPoolID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/netapp/validate/snapshot_id.go b/internal/services/netapp/validate/snapshot_id.go deleted file mode 100644 index 1f5cea117a61..000000000000 --- a/internal/services/netapp/validate/snapshot_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func SnapshotID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SnapshotID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/netapp/validate/snapshot_id_test.go b/internal/services/netapp/validate/snapshot_id_test.go deleted file mode 100644 index 7a42e62fece0..000000000000 --- a/internal/services/netapp/validate/snapshot_id_test.go +++ /dev/null @@ -1,112 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestSnapshotID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Valid: false, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Valid: false, - }, - - { - // missing CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Valid: false, - }, - - { - // missing value for CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/", - Valid: false, - }, - - { - // missing VolumeName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/", - Valid: false, - }, - - { - // missing value for VolumeName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1/snapshots/snapshot1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/CAPACITYPOOLS/POOL1/VOLUMES/VOLUME1/SNAPSHOTS/SNAPSHOT1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := SnapshotID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/netapp/validate/snapshot_policy_id.go b/internal/services/netapp/validate/snapshot_policy_id.go deleted file mode 100644 index 33efd5e77ad8..000000000000 --- a/internal/services/netapp/validate/snapshot_policy_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func SnapshotPolicyID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.SnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/netapp/validate/snapshot_policy_id_test.go b/internal/services/netapp/validate/snapshot_policy_id_test.go deleted file mode 100644 index 4c755c98555c..000000000000 --- a/internal/services/netapp/validate/snapshot_policy_id_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestSnapshotPolicyID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Valid: false, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/SNAPSHOTPOLICIES/SNAPSHOTPOLICY1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := SnapshotPolicyID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/internal/services/netapp/validate/volume_id.go b/internal/services/netapp/validate/volume_id.go deleted file mode 100644 index c96095fbc397..000000000000 --- a/internal/services/netapp/validate/volume_id.go +++ /dev/null @@ -1,23 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/parse" -) - -func VolumeID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.VolumeID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/netapp/validate/volume_id_test.go b/internal/services/netapp/validate/volume_id_test.go deleted file mode 100644 index 5e799b218ce0..000000000000 --- a/internal/services/netapp/validate/volume_id_test.go +++ /dev/null @@ -1,100 +0,0 @@ -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestVolumeID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/", - Valid: false, - }, - - { - // missing value for NetAppAccountName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/", - Valid: false, - }, - - { - // missing CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/", - Valid: false, - }, - - { - // missing value for CapacityPoolName - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.NetApp/netAppAccounts/account1/capacityPools/pool1/volumes/volume1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETAPP/NETAPPACCOUNTS/ACCOUNT1/CAPACITYPOOLS/POOL1/VOLUMES/VOLUME1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := VolumeID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/CHANGELOG.md b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/CHANGELOG.md deleted file mode 100644 index 52911e4cc5e4..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/CHANGELOG.md +++ /dev/null @@ -1,2 +0,0 @@ -# Change History - diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/_meta.json b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/_meta.json deleted file mode 100644 index 85e4ce68e842..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/_meta.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "commit": "bb9f1204f9a337404ff7e7b73b4c7b4ddde7f8f1", - "readme": "/_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", - "tag": "package-netapp-2021-10-01", - "use": "@microsoft.azure/autorest.go@2.1.187", - "repository_url": "https://github.com/Azure/azure-rest-api-specs.git", - "autorest_command": "autorest --use=@microsoft.azure/autorest.go@2.1.187 --tag=package-netapp-2021-10-01 --go-sdk-folder=/_/azure-sdk-for-go --go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix /_/azure-rest-api-specs/specification/netapp/resource-manager/readme.md", - "additional_properties": { - "additional_options": "--go --verbose --use-onever --version=2.0.4421 --go.license-header=MICROSOFT_MIT_NO_VERSION --enum-prefix" - } -} \ No newline at end of file diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accountbackups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accountbackups.go deleted file mode 100644 index 0c1f8bb6327c..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accountbackups.go +++ /dev/null @@ -1,290 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountBackupsClient is the microsoft NetApp Files Azure Resource Provider specification -type AccountBackupsClient struct { - BaseClient -} - -// NewAccountBackupsClient creates an instance of the AccountBackupsClient client. -func NewAccountBackupsClient(subscriptionID string) AccountBackupsClient { - return NewAccountBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountBackupsClientWithBaseURI creates an instance of the AccountBackupsClient 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 NewAccountBackupsClientWithBaseURI(baseURI string, subscriptionID string) AccountBackupsClient { - return AccountBackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Delete delete the specified Backup for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupName - the name of the backup -func (client AccountBackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result AccountBackupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.AccountBackupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountBackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountBackupsClient) DeleteSender(req *http.Request) (future AccountBackupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountBackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified backup for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupName - the name of the backup -func (client AccountBackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupName string) (result Backup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.AccountBackupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountBackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/accountBackups/{backupName}", 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 AccountBackupsClient) 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 AccountBackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all Backups for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountBackupsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountBackupsClient.List") - 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.AccountBackupsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountBackupsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/accountBackups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountBackupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountBackupsClient) ListResponder(resp *http.Response) (result BackupsList, 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/netapp/mgmt/2021-10-01/netapp/accounts.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accounts.go deleted file mode 100644 index 2e1934acc518..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/accounts.go +++ /dev/null @@ -1,629 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// AccountsClient is the microsoft NetApp Files Azure Resource Provider specification -type AccountsClient struct { - BaseClient -} - -// NewAccountsClient creates an instance of the AccountsClient client. -func NewAccountsClient(subscriptionID string) AccountsClient { - return NewAccountsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewAccountsClientWithBaseURI creates an instance of the AccountsClient 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 NewAccountsClientWithBaseURI(baseURI string, subscriptionID string) AccountsClient { - return AccountsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or update the specified NetApp account within the resource group -// Parameters: -// body - netApp Account object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) CreateOrUpdate(ctx context.Context, body Account, resourceGroupName string, accountName string) (result AccountsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.AccountsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client AccountsClient) CreateOrUpdatePreparer(ctx context.Context, body Account, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) CreateOrUpdateSender(req *http.Request) (future AccountsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client AccountsClient) CreateOrUpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified NetApp account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) Delete(ctx context.Context, resourceGroupName string, accountName string) (result AccountsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.AccountsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client AccountsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) DeleteSender(req *http.Request) (future AccountsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client AccountsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get the NetApp account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) Get(ctx context.Context, resourceGroupName string, accountName string) (result Account, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.AccountsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client AccountsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}", 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 AccountsClient) 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 AccountsClient) GetResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// 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 AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.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.AccountsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure sending request") - return - } - - result.al, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "List", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client AccountsClient) ListPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client AccountsClient) listNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListComplete(ctx context.Context, resourceGroupName string) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName) - return -} - -// ListBySubscription list and describe all NetApp accounts in the subscription. -func (client AccountsClient) ListBySubscription(ctx context.Context) (result AccountListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.al.Response.Response != nil { - sc = result.al.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.fn = client.listBySubscriptionNextResults - req, err := client.ListBySubscriptionPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", nil, "Failure preparing request") - return - } - - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.al.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", resp, "Failure sending request") - return - } - - result.al, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "ListBySubscription", resp, "Failure responding to request") - return - } - if result.al.hasNextLink() && result.al.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListBySubscriptionPreparer prepares the ListBySubscription request. -func (client AccountsClient) ListBySubscriptionPreparer(ctx context.Context) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListBySubscriptionSender sends the ListBySubscription request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) ListBySubscriptionSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListBySubscriptionResponder handles the response to the ListBySubscription request. The method always -// closes the http.Response Body. -func (client AccountsClient) ListBySubscriptionResponder(resp *http.Response) (result AccountList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listBySubscriptionNextResults retrieves the next set of results, if any. -func (client AccountsClient) listBySubscriptionNextResults(ctx context.Context, lastResults AccountList) (result AccountList, err error) { - req, err := lastResults.accountListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListBySubscriptionSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", resp, "Failure sending next results request") - } - result, err = client.ListBySubscriptionResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "listBySubscriptionNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListBySubscriptionComplete enumerates all values, automatically crossing page boundaries as required. -func (client AccountsClient) ListBySubscriptionComplete(ctx context.Context) (result AccountListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.ListBySubscription") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListBySubscription(ctx) - return -} - -// Update patch the specified NetApp account -// Parameters: -// body - netApp Account object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client AccountsClient) Update(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (result AccountsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.AccountsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client AccountsClient) UpdatePreparer(ctx context.Context, body AccountPatch, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client AccountsClient) UpdateSender(req *http.Request) (future AccountsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client AccountsClient) UpdateResponder(resp *http.Response) (result Account, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backuppolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backuppolicies.go deleted file mode 100644 index 2073c2dd3d49..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backuppolicies.go +++ /dev/null @@ -1,485 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// BackupPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification -type BackupPoliciesClient struct { - BaseClient -} - -// NewBackupPoliciesClient creates an instance of the BackupPoliciesClient client. -func NewBackupPoliciesClient(subscriptionID string) BackupPoliciesClient { - return NewBackupPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupPoliciesClientWithBaseURI creates an instance of the BackupPoliciesClient 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 NewBackupPoliciesClientWithBaseURI(baseURI string, subscriptionID string) BackupPoliciesClient { - return BackupPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a backup policy for Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -// body - backup policy object supplied in the body of the operation. -func (client BackupPoliciesClient) Create(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (result BackupPoliciesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.BackupPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupPoliciesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client BackupPoliciesClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicy) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) CreateSender(req *http.Request) (future BackupPoliciesCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) CreateResponder(resp *http.Response) (result BackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete backup policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -func (client BackupPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPoliciesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.BackupPoliciesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, backupPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) DeleteSender(req *http.Request) (future BackupPoliciesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a particular backup Policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -func (client BackupPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (result BackupPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.BackupPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, backupPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/backupPolicies/{backupPolicyName}", 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 BackupPoliciesClient) 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 BackupPoliciesClient) GetResponder(resp *http.Response) (result BackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list backup policies for Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client BackupPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result BackupPoliciesList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.List") - 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.BackupPoliciesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/backupPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) ListResponder(resp *http.Response) (result BackupPoliciesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update patch a backup policy for Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// backupPolicyName - backup policy Name which uniquely identify backup policy. -// body - backup policy object supplied in the body of the operation. -func (client BackupPoliciesClient) Update(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (result BackupPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.BackupPoliciesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, backupPolicyName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupPoliciesClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, backupPolicyName string, body BackupPolicyPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupPolicyName": autorest.Encode("path", backupPolicyName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupPoliciesClient) UpdateSender(req *http.Request) (future BackupPoliciesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupPoliciesClient) UpdateResponder(resp *http.Response) (result BackupPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backups.go deleted file mode 100644 index e430721365de..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/backups.go +++ /dev/null @@ -1,741 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// BackupsClient is the microsoft NetApp Files Azure Resource Provider specification -type BackupsClient struct { - BaseClient -} - -// NewBackupsClient creates an instance of the BackupsClient client. -func NewBackupsClient(subscriptionID string) BackupsClient { - return NewBackupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewBackupsClientWithBaseURI creates an instance of the BackupsClient 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 NewBackupsClientWithBaseURI(baseURI string, subscriptionID string) BackupsClient { - return BackupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a backup for the 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 -// backupName - the name of the backup -// body - backup object supplied in the body of the operation. -func (client BackupsClient) Create(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (result BackupsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.BackupProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.BackupProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.BackupProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.BackupProperties.BackupID", 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}, - }}, - }}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client BackupsClient) CreatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body Backup) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) CreateSender(req *http.Request) (future BackupsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client BackupsClient) CreateResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete a backup of the 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 -// backupName - the name of the backup -func (client BackupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result BackupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client BackupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) DeleteSender(req *http.Request) (future BackupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client BackupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get gets the specified backup of the 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 -// backupName - the name of the backup -func (client BackupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (result Backup, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client BackupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-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}/backups/{backupName}", 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 BackupsClient) 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 BackupsClient) GetResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetStatus get the status of the backup for a 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 BackupsClient) GetStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetStatus") - 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "GetStatus", err.Error()) - } - - req, err := client.GetStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure sending request") - return - } - - result, err = client.GetStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetStatusPreparer prepares the GetStatus request. -func (client BackupsClient) GetStatusPreparer(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 = "2021-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}/backupStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetStatusSender sends the GetStatus request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) GetStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetStatusResponder handles the response to the GetStatus request. The method always -// closes the http.Response Body. -func (client BackupsClient) GetStatusResponder(resp *http.Response) (result BackupStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetVolumeRestoreStatus get the status of the restore for a 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 BackupsClient) GetVolumeRestoreStatus(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result RestoreStatus, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.GetVolumeRestoreStatus") - 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "GetVolumeRestoreStatus", err.Error()) - } - - req, err := client.GetVolumeRestoreStatusPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", nil, "Failure preparing request") - return - } - - resp, err := client.GetVolumeRestoreStatusSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", resp, "Failure sending request") - return - } - - result, err = client.GetVolumeRestoreStatusResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "GetVolumeRestoreStatus", resp, "Failure responding to request") - return - } - - return -} - -// GetVolumeRestoreStatusPreparer prepares the GetVolumeRestoreStatus request. -func (client BackupsClient) GetVolumeRestoreStatusPreparer(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 = "2021-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}/restoreStatus", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetVolumeRestoreStatusSender sends the GetVolumeRestoreStatus request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) GetVolumeRestoreStatusSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// GetVolumeRestoreStatusResponder handles the response to the GetVolumeRestoreStatus request. The method always -// closes the http.Response Body. -func (client BackupsClient) GetVolumeRestoreStatusResponder(resp *http.Response) (result RestoreStatus, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all backups for a 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 BackupsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result BackupsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.List") - 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client BackupsClient) ListPreparer(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 = "2021-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}/backups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client BackupsClient) ListResponder(resp *http.Response) (result BackupsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update patch a backup for the 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 -// backupName - the name of the backup -// body - backup object supplied in the body of the operation. -func (client BackupsClient) Update(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (result BackupsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/BackupsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.BackupsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, backupName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client BackupsClient) UpdatePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, backupName string, body *BackupPatch) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "backupName": autorest.Encode("path", backupName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client BackupsClient) UpdateSender(req *http.Request) (future BackupsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client BackupsClient) UpdateResponder(resp *http.Response) (result Backup, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/client.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/client.go deleted file mode 100644 index 780c3590d75f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/client.go +++ /dev/null @@ -1,41 +0,0 @@ -// Package netapp implements the Azure ARM Netapp service API version 2021-10-01. -// -// Microsoft NetApp Files Azure Resource Provider specification -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "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 using a custom endpoint. Use this when interacting with -// an Azure cloud that uses a non-standard base URI (sovereign clouds, Azure stack). -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/2021-10-01/netapp/enums.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/enums.go deleted file mode 100644 index 8fa945a3125e..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/enums.go +++ /dev/null @@ -1,346 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// ActiveDirectoryStatus enumerates the values for active directory status. -type ActiveDirectoryStatus string - -const ( - // ActiveDirectoryStatusCreated Active Directory created but not in use - ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" - // ActiveDirectoryStatusDeleted Active Directory Deleted - ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" - // ActiveDirectoryStatusError Error with the Active Directory - ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" - // ActiveDirectoryStatusInUse Active Directory in use by SMB Volume - ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" - // ActiveDirectoryStatusUpdating Active Directory Updating - ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" -) - -// PossibleActiveDirectoryStatusValues returns an array of possible values for the ActiveDirectoryStatus const type. -func PossibleActiveDirectoryStatusValues() []ActiveDirectoryStatus { - return []ActiveDirectoryStatus{ActiveDirectoryStatusCreated, ActiveDirectoryStatusDeleted, ActiveDirectoryStatusError, ActiveDirectoryStatusInUse, ActiveDirectoryStatusUpdating} -} - -// ApplicationType enumerates the values for application type. -type ApplicationType string - -const ( - // ApplicationTypeSAPHANA ... - ApplicationTypeSAPHANA ApplicationType = "SAP-HANA" -) - -// PossibleApplicationTypeValues returns an array of possible values for the ApplicationType const type. -func PossibleApplicationTypeValues() []ApplicationType { - return []ApplicationType{ApplicationTypeSAPHANA} -} - -// AvsDataStore enumerates the values for avs data store. -type AvsDataStore string - -const ( - // AvsDataStoreDisabled avsDataStore is disabled - AvsDataStoreDisabled AvsDataStore = "Disabled" - // AvsDataStoreEnabled avsDataStore is enabled - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -// PossibleAvsDataStoreValues returns an array of possible values for the AvsDataStore const type. -func PossibleAvsDataStoreValues() []AvsDataStore { - return []AvsDataStore{AvsDataStoreDisabled, AvsDataStoreEnabled} -} - -// BackupType enumerates the values for backup type. -type BackupType string - -const ( - // BackupTypeManual Manual backup - BackupTypeManual BackupType = "Manual" - // BackupTypeScheduled Scheduled backup - BackupTypeScheduled BackupType = "Scheduled" -) - -// PossibleBackupTypeValues returns an array of possible values for the BackupType const type. -func PossibleBackupTypeValues() []BackupType { - return []BackupType{BackupTypeManual, BackupTypeScheduled} -} - -// CheckNameResourceTypes enumerates the values for check name resource types. -type CheckNameResourceTypes string - -const ( - // CheckNameResourceTypesMicrosoftNetAppnetAppAccounts ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - // CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - // CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - // CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... - CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -// PossibleCheckNameResourceTypesValues returns an array of possible values for the CheckNameResourceTypes const type. -func PossibleCheckNameResourceTypesValues() []CheckNameResourceTypes { - return []CheckNameResourceTypes{CheckNameResourceTypesMicrosoftNetAppnetAppAccounts, CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools, CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes, CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} -} - -// CheckQuotaNameResourceTypes enumerates the values for check quota name resource types. -type CheckQuotaNameResourceTypes string - -const ( - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - // CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots ... - CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -// PossibleCheckQuotaNameResourceTypesValues returns an array of possible values for the CheckQuotaNameResourceTypes const type. -func PossibleCheckQuotaNameResourceTypesValues() []CheckQuotaNameResourceTypes { - return []CheckQuotaNameResourceTypes{CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes, CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots} -} - -// ChownMode enumerates the values for chown mode. -type ChownMode string - -const ( - // ChownModeRestricted ... - ChownModeRestricted ChownMode = "Restricted" - // ChownModeUnrestricted ... - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -// PossibleChownModeValues returns an array of possible values for the ChownMode const type. -func PossibleChownModeValues() []ChownMode { - return []ChownMode{ChownModeRestricted, ChownModeUnrestricted} -} - -// CreatedByType enumerates the values for created by type. -type CreatedByType string - -const ( - // CreatedByTypeApplication ... - CreatedByTypeApplication CreatedByType = "Application" - // CreatedByTypeKey ... - CreatedByTypeKey CreatedByType = "Key" - // CreatedByTypeManagedIdentity ... - CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - // CreatedByTypeUser ... - CreatedByTypeUser CreatedByType = "User" -) - -// PossibleCreatedByTypeValues returns an array of possible values for the CreatedByType const type. -func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, CreatedByTypeUser} -} - -// EnableSubvolumes enumerates the values for enable subvolumes. -type EnableSubvolumes string - -const ( - // EnableSubvolumesDisabled subvolumes are not enabled - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - // EnableSubvolumesEnabled subvolumes are enabled - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -// PossibleEnableSubvolumesValues returns an array of possible values for the EnableSubvolumes const type. -func PossibleEnableSubvolumesValues() []EnableSubvolumes { - return []EnableSubvolumes{EnableSubvolumesDisabled, EnableSubvolumesEnabled} -} - -// EncryptionType enumerates the values for encryption type. -type EncryptionType string - -const ( - // EncryptionTypeDouble EncryptionType Double, volumes will use double encryption at rest - EncryptionTypeDouble EncryptionType = "Double" - // EncryptionTypeSingle EncryptionType Single, volumes will use single encryption at rest - EncryptionTypeSingle EncryptionType = "Single" -) - -// PossibleEncryptionTypeValues returns an array of possible values for the EncryptionType const type. -func PossibleEncryptionTypeValues() []EncryptionType { - return []EncryptionType{EncryptionTypeDouble, EncryptionTypeSingle} -} - -// EndpointType enumerates the values for endpoint type. -type EndpointType string - -const ( - // EndpointTypeDst ... - EndpointTypeDst EndpointType = "dst" - // EndpointTypeSrc ... - EndpointTypeSrc EndpointType = "src" -) - -// PossibleEndpointTypeValues returns an array of possible values for the EndpointType const type. -func PossibleEndpointTypeValues() []EndpointType { - return []EndpointType{EndpointTypeDst, EndpointTypeSrc} -} - -// InAvailabilityReasonType enumerates the values for in availability reason type. -type InAvailabilityReasonType string - -const ( - // InAvailabilityReasonTypeAlreadyExists ... - InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" - // InAvailabilityReasonTypeInvalid ... - InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" -) - -// PossibleInAvailabilityReasonTypeValues returns an array of possible values for the InAvailabilityReasonType const type. -func PossibleInAvailabilityReasonTypeValues() []InAvailabilityReasonType { - return []InAvailabilityReasonType{InAvailabilityReasonTypeAlreadyExists, InAvailabilityReasonTypeInvalid} -} - -// MetricAggregationType enumerates the values for metric aggregation type. -type MetricAggregationType string - -const ( - // MetricAggregationTypeAverage ... - MetricAggregationTypeAverage MetricAggregationType = "Average" -) - -// PossibleMetricAggregationTypeValues returns an array of possible values for the MetricAggregationType const type. -func PossibleMetricAggregationTypeValues() []MetricAggregationType { - return []MetricAggregationType{MetricAggregationTypeAverage} -} - -// MirrorState enumerates the values for mirror state. -type MirrorState string - -const ( - // MirrorStateBroken ... - MirrorStateBroken MirrorState = "Broken" - // MirrorStateMirrored ... - MirrorStateMirrored MirrorState = "Mirrored" - // MirrorStateUninitialized ... - MirrorStateUninitialized MirrorState = "Uninitialized" -) - -// PossibleMirrorStateValues returns an array of possible values for the MirrorState const type. -func PossibleMirrorStateValues() []MirrorState { - return []MirrorState{MirrorStateBroken, MirrorStateMirrored, MirrorStateUninitialized} -} - -// NetworkFeatures enumerates the values for network features. -type NetworkFeatures string - -const ( - // NetworkFeaturesBasic Basic network feature. - NetworkFeaturesBasic NetworkFeatures = "Basic" - // NetworkFeaturesStandard Standard network feature. - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -// PossibleNetworkFeaturesValues returns an array of possible values for the NetworkFeatures const type. -func PossibleNetworkFeaturesValues() []NetworkFeatures { - return []NetworkFeatures{NetworkFeaturesBasic, NetworkFeaturesStandard} -} - -// QosType enumerates the values for qos type. -type QosType string - -const ( - // QosTypeAuto qos type Auto - QosTypeAuto QosType = "Auto" - // QosTypeManual qos type Manual - QosTypeManual QosType = "Manual" -) - -// PossibleQosTypeValues returns an array of possible values for the QosType const type. -func PossibleQosTypeValues() []QosType { - return []QosType{QosTypeAuto, QosTypeManual} -} - -// RelationshipStatus enumerates the values for relationship status. -type RelationshipStatus string - -const ( - // RelationshipStatusIdle ... - RelationshipStatusIdle RelationshipStatus = "Idle" - // RelationshipStatusTransferring ... - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -// PossibleRelationshipStatusValues returns an array of possible values for the RelationshipStatus const type. -func PossibleRelationshipStatusValues() []RelationshipStatus { - return []RelationshipStatus{RelationshipStatusIdle, RelationshipStatusTransferring} -} - -// ReplicationSchedule enumerates the values for replication schedule. -type ReplicationSchedule string - -const ( - // ReplicationSchedule10minutely ... - ReplicationSchedule10minutely ReplicationSchedule = "_10minutely" - // ReplicationScheduleDaily ... - ReplicationScheduleDaily ReplicationSchedule = "daily" - // ReplicationScheduleHourly ... - ReplicationScheduleHourly ReplicationSchedule = "hourly" -) - -// PossibleReplicationScheduleValues returns an array of possible values for the ReplicationSchedule const type. -func PossibleReplicationScheduleValues() []ReplicationSchedule { - return []ReplicationSchedule{ReplicationSchedule10minutely, ReplicationScheduleDaily, ReplicationScheduleHourly} -} - -// SecurityStyle enumerates the values for security style. -type SecurityStyle string - -const ( - // SecurityStyleNtfs ... - SecurityStyleNtfs SecurityStyle = "ntfs" - // SecurityStyleUnix ... - SecurityStyleUnix SecurityStyle = "unix" -) - -// PossibleSecurityStyleValues returns an array of possible values for the SecurityStyle const type. -func PossibleSecurityStyleValues() []SecurityStyle { - return []SecurityStyle{SecurityStyleNtfs, SecurityStyleUnix} -} - -// ServiceLevel enumerates the values for service level. -type ServiceLevel string - -const ( - // ServiceLevelPremium Premium service level - ServiceLevelPremium ServiceLevel = "Premium" - // ServiceLevelStandard Standard service level - ServiceLevelStandard ServiceLevel = "Standard" - // ServiceLevelStandardZRS Zone redundant storage service level - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - // ServiceLevelUltra Ultra service level - ServiceLevelUltra ServiceLevel = "Ultra" -) - -// PossibleServiceLevelValues returns an array of possible values for the ServiceLevel const type. -func PossibleServiceLevelValues() []ServiceLevel { - return []ServiceLevel{ServiceLevelPremium, ServiceLevelStandard, ServiceLevelStandardZRS, ServiceLevelUltra} -} - -// VolumeStorageToNetworkProximity enumerates the values for volume storage to network proximity. -type VolumeStorageToNetworkProximity string - -const ( - // VolumeStorageToNetworkProximityDefault Basic storage to network connectivity. - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - // VolumeStorageToNetworkProximityT1 Standard T1 storage to network connectivity. - VolumeStorageToNetworkProximityT1 VolumeStorageToNetworkProximity = "T1" - // VolumeStorageToNetworkProximityT2 Standard T2 storage to network connectivity. - VolumeStorageToNetworkProximityT2 VolumeStorageToNetworkProximity = "T2" -) - -// PossibleVolumeStorageToNetworkProximityValues returns an array of possible values for the VolumeStorageToNetworkProximity const type. -func PossibleVolumeStorageToNetworkProximityValues() []VolumeStorageToNetworkProximity { - return []VolumeStorageToNetworkProximity{VolumeStorageToNetworkProximityDefault, VolumeStorageToNetworkProximityT1, VolumeStorageToNetworkProximityT2} -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/models.go deleted file mode 100644 index 81c786643da8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/models.go +++ /dev/null @@ -1,5721 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "encoding/json" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/autorest/to" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// The package's fully qualified name. -const fqdn = "github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp" - -// Account netApp account resource -type Account struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // AccountProperties - NetApp Account properties - *AccountProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Account. -func (a Account) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if a.Location != nil { - objectMap["location"] = a.Location - } - if a.Tags != nil { - objectMap["tags"] = a.Tags - } - if a.AccountProperties != nil { - objectMap["properties"] = a.AccountProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Account struct. -func (a *Account) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - a.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - a.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - a.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - a.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - a.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - a.Tags = tags - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - a.AccountProperties = &accountProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - a.SystemData = &systemData - } - } - } - - return nil -} - -// AccountBackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountBackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountBackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountBackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountBackupsDeleteFuture.Result. -func (future *AccountBackupsDeleteFuture) result(client AccountBackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountBackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountBackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountEncryption encryption settings -type AccountEncryption struct { - // KeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - KeySource *string `json:"keySource,omitempty"` -} - -// AccountList list of NetApp account resources -type AccountList struct { - autorest.Response `json:"-"` - // Value - Multiple NetApp accounts - Value *[]Account `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// AccountListIterator provides access to a complete listing of Account values. -type AccountListIterator struct { - i int - page AccountListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *AccountListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *AccountListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter AccountListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter AccountListIterator) Response() AccountList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter AccountListIterator) Value() Account { - if !iter.page.NotDone() { - return Account{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the AccountListIterator type. -func NewAccountListIterator(page AccountListPage) AccountListIterator { - return AccountListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (al AccountList) IsEmpty() bool { - return al.Value == nil || len(*al.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (al AccountList) hasNextLink() bool { - return al.NextLink != nil && len(*al.NextLink) != 0 -} - -// accountListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (al AccountList) accountListPreparer(ctx context.Context) (*http.Request, error) { - if !al.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(al.NextLink))) -} - -// AccountListPage contains a page of Account values. -type AccountListPage struct { - fn func(context.Context, AccountList) (AccountList, error) - al AccountList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *AccountListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/AccountListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.al) - if err != nil { - return err - } - page.al = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *AccountListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page AccountListPage) NotDone() bool { - return !page.al.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page AccountListPage) Response() AccountList { - return page.al -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page AccountListPage) Values() []Account { - if page.al.IsEmpty() { - return nil - } - return *page.al.Value -} - -// Creates a new instance of the AccountListPage type. -func NewAccountListPage(cur AccountList, getNextPage func(context.Context, AccountList) (AccountList, error)) AccountListPage { - return AccountListPage{ - fn: getNextPage, - al: cur, - } -} - -// AccountPatch netApp account patch resource -type AccountPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // AccountProperties - NetApp Account properties - *AccountProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountPatch. -func (ap AccountPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.Location != nil { - objectMap["location"] = ap.Location - } - if ap.Tags != nil { - objectMap["tags"] = ap.Tags - } - if ap.AccountProperties != nil { - objectMap["properties"] = ap.AccountProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for AccountPatch struct. -func (ap *AccountPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - ap.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - ap.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - ap.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - ap.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - ap.Tags = tags - } - case "properties": - if v != nil { - var accountProperties AccountProperties - err = json.Unmarshal(*v, &accountProperties) - if err != nil { - return err - } - ap.AccountProperties = &accountProperties - } - } - } - - return nil -} - -// AccountProperties netApp account properties -type AccountProperties struct { - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // ActiveDirectories - Active Directories - ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` - // Encryption - Encryption settings - Encryption *AccountEncryption `json:"encryption,omitempty"` -} - -// MarshalJSON is the custom marshaler for AccountProperties. -func (ap AccountProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ap.ActiveDirectories != nil { - objectMap["activeDirectories"] = ap.ActiveDirectories - } - if ap.Encryption != nil { - objectMap["encryption"] = ap.Encryption - } - return json.Marshal(objectMap) -} - -// AccountsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsCreateOrUpdateFuture.Result. -func (future *AccountsCreateOrUpdateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.CreateOrUpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsCreateOrUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// AccountsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsDeleteFuture.Result. -func (future *AccountsDeleteFuture) result(client AccountsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// AccountsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type AccountsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(AccountsClient) (Account, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *AccountsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for AccountsUpdateFuture.Result. -func (future *AccountsUpdateFuture) result(client AccountsClient) (a Account, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - a.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.AccountsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if a.Response.Response, err = future.GetResult(sender); err == nil && a.Response.Response.StatusCode != http.StatusNoContent { - a, err = client.UpdateResponder(a.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.AccountsUpdateFuture", "Result", a.Response.Response, "Failure responding to request") - } - } - return -} - -// ActiveDirectory active Directory -type ActiveDirectory struct { - // ActiveDirectoryID - Id of the Active Directory - ActiveDirectoryID *string `json:"activeDirectoryId,omitempty"` - // Username - Username of Active Directory domain administrator - Username *string `json:"username,omitempty"` - // Password - Plain text password of Active Directory domain administrator, value is masked in the response - 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 (IPv4 only) for the Active Directory domain - DNS *string `json:"dns,omitempty"` - // Status - READ-ONLY; Status of the Active Directory. Possible values include: 'ActiveDirectoryStatusCreated', 'ActiveDirectoryStatusInUse', 'ActiveDirectoryStatusDeleted', 'ActiveDirectoryStatusError', 'ActiveDirectoryStatusUpdating' - Status ActiveDirectoryStatus `json:"status,omitempty"` - // StatusDetails - READ-ONLY; Any details in regards to the Status of the Active Directory - StatusDetails *string `json:"statusDetails,omitempty"` - // SmbServerName - NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes - SmbServerName *string `json:"smbServerName,omitempty"` - // OrganizationalUnit - The Organizational Unit (OU) within the Windows Active Directory - OrganizationalUnit *string `json:"organizationalUnit,omitempty"` - // Site - The Active Directory site the service will limit Domain Controller discovery to - Site *string `json:"site,omitempty"` - // BackupOperators - Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier - BackupOperators *[]string `json:"backupOperators,omitempty"` - // Administrators - Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier - Administrators *[]string `json:"administrators,omitempty"` - // KdcIP - kdc server IP addresses for the active directory machine. This optional parameter is used only while creating kerberos volume. - KdcIP *string `json:"kdcIP,omitempty"` - // AdName - Name of the active directory machine. This optional parameter is used only while creating kerberos volume - AdName *string `json:"adName,omitempty"` - // ServerRootCACertificate - When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. - ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` - // AesEncryption - If enabled, AES encryption will be enabled for SMB communication. - AesEncryption *bool `json:"aesEncryption,omitempty"` - // LdapSigning - Specifies whether or not the LDAP traffic needs to be signed. - LdapSigning *bool `json:"ldapSigning,omitempty"` - // SecurityOperators - Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier - SecurityOperators *[]string `json:"securityOperators,omitempty"` - // LdapOverTLS - Specifies whether or not the LDAP traffic needs to be secured via TLS. - LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` - // AllowLocalNfsUsersWithLdap - If enabled, NFS client local users can also (in addition to LDAP users) access the NFS volumes. - AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` - // EncryptDCConnections - If enabled, Traffic between the SMB server to Domain Controller (DC) will be encrypted. - EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` - // LdapSearchScope - LDAP Search scope options - LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` -} - -// MarshalJSON is the custom marshaler for ActiveDirectory. -func (ad ActiveDirectory) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ad.ActiveDirectoryID != nil { - objectMap["activeDirectoryId"] = ad.ActiveDirectoryID - } - if ad.Username != nil { - objectMap["username"] = ad.Username - } - if ad.Password != nil { - objectMap["password"] = ad.Password - } - if ad.Domain != nil { - objectMap["domain"] = ad.Domain - } - if ad.DNS != nil { - objectMap["dns"] = ad.DNS - } - if ad.SmbServerName != nil { - objectMap["smbServerName"] = ad.SmbServerName - } - if ad.OrganizationalUnit != nil { - objectMap["organizationalUnit"] = ad.OrganizationalUnit - } - if ad.Site != nil { - objectMap["site"] = ad.Site - } - if ad.BackupOperators != nil { - objectMap["backupOperators"] = ad.BackupOperators - } - if ad.Administrators != nil { - objectMap["administrators"] = ad.Administrators - } - if ad.KdcIP != nil { - objectMap["kdcIP"] = ad.KdcIP - } - if ad.AdName != nil { - objectMap["adName"] = ad.AdName - } - if ad.ServerRootCACertificate != nil { - objectMap["serverRootCACertificate"] = ad.ServerRootCACertificate - } - if ad.AesEncryption != nil { - objectMap["aesEncryption"] = ad.AesEncryption - } - if ad.LdapSigning != nil { - objectMap["ldapSigning"] = ad.LdapSigning - } - if ad.SecurityOperators != nil { - objectMap["securityOperators"] = ad.SecurityOperators - } - if ad.LdapOverTLS != nil { - objectMap["ldapOverTLS"] = ad.LdapOverTLS - } - if ad.AllowLocalNfsUsersWithLdap != nil { - objectMap["allowLocalNfsUsersWithLdap"] = ad.AllowLocalNfsUsersWithLdap - } - if ad.EncryptDCConnections != nil { - objectMap["encryptDCConnections"] = ad.EncryptDCConnections - } - if ad.LdapSearchScope != nil { - objectMap["ldapSearchScope"] = ad.LdapSearchScope - } - return json.Marshal(objectMap) -} - -// AuthorizeRequest authorize request -type AuthorizeRequest struct { - // RemoteVolumeResourceID - Resource id of the remote volume - RemoteVolumeResourceID *string `json:"remoteVolumeResourceId,omitempty"` -} - -// AzureEntityResource the resource model definition for an Azure Resource Manager resource with an etag. -type AzureEntityResource struct { - // Etag - READ-ONLY; Resource Etag. - Etag *string `json:"etag,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for AzureEntityResource. -func (aer AzureEntityResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// Backup backup of a Volume -type Backup struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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"` - // BackupProperties - Backup Properties - *BackupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Backup. -func (b Backup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if b.Location != nil { - objectMap["location"] = b.Location - } - if b.BackupProperties != nil { - objectMap["properties"] = b.BackupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Backup struct. -func (b *Backup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - b.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - b.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - b.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - b.Type = &typeVar - } - case "properties": - if v != nil { - var backupProperties BackupProperties - err = json.Unmarshal(*v, &backupProperties) - if err != nil { - return err - } - b.BackupProperties = &backupProperties - } - } - } - - return nil -} - -// BackupPatch backup patch -type BackupPatch struct { - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // BackupProperties - Backup Properties - *BackupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPatch. -func (bp BackupPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Tags != nil { - objectMap["tags"] = bp.Tags - } - if bp.BackupProperties != nil { - objectMap["properties"] = bp.BackupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPatch struct. -func (bp *BackupPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bp.Tags = tags - } - case "properties": - if v != nil { - var backupProperties BackupProperties - err = json.Unmarshal(*v, &backupProperties) - if err != nil { - return err - } - bp.BackupProperties = &backupProperties - } - } - } - - return nil -} - -// BackupPoliciesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupPoliciesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupPoliciesClient) (BackupPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupPoliciesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupPoliciesCreateFuture.Result. -func (future *BackupPoliciesCreateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { - bp, err = client.CreateResponder(bp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesCreateFuture", "Result", bp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupPoliciesDeleteFuture.Result. -func (future *BackupPoliciesDeleteFuture) result(client BackupPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BackupPoliciesList list of Backup Policies -type BackupPoliciesList struct { - autorest.Response `json:"-"` - // Value - A list of backup policies - Value *[]BackupPolicy `json:"value,omitempty"` -} - -// BackupPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupPoliciesClient) (BackupPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupPoliciesUpdateFuture.Result. -func (future *BackupPoliciesUpdateFuture) result(client BackupPoliciesClient) (bp BackupPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - bp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if bp.Response.Response, err = future.GetResult(sender); err == nil && bp.Response.Response.StatusCode != http.StatusNoContent { - bp, err = client.UpdateResponder(bp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupPoliciesUpdateFuture", "Result", bp.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupPolicy backup policy information -type BackupPolicy struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // BackupPolicyProperties - Backup policy Properties - *BackupPolicyProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicy. -func (bp BackupPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Location != nil { - objectMap["location"] = bp.Location - } - if bp.Tags != nil { - objectMap["tags"] = bp.Tags - } - if bp.BackupPolicyProperties != nil { - objectMap["properties"] = bp.BackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicy struct. -func (bp *BackupPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - bp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bp.Tags = tags - } - case "properties": - if v != nil { - var backupPolicyProperties BackupPolicyProperties - err = json.Unmarshal(*v, &backupPolicyProperties) - if err != nil { - return err - } - bp.BackupPolicyProperties = &backupPolicyProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - bp.SystemData = &systemData - } - } - } - - return nil -} - -// BackupPolicyDetails backup policy properties -type BackupPolicyDetails struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // BackupPolicyProperties - Backup policy Properties - *BackupPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicyDetails. -func (bpd BackupPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bpd.Location != nil { - objectMap["location"] = bpd.Location - } - if bpd.Tags != nil { - objectMap["tags"] = bpd.Tags - } - if bpd.BackupPolicyProperties != nil { - objectMap["properties"] = bpd.BackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicyDetails struct. -func (bpd *BackupPolicyDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bpd.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bpd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bpd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bpd.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bpd.Tags = tags - } - case "properties": - if v != nil { - var backupPolicyProperties BackupPolicyProperties - err = json.Unmarshal(*v, &backupPolicyProperties) - if err != nil { - return err - } - bpd.BackupPolicyProperties = &backupPolicyProperties - } - } - } - - return nil -} - -// BackupPolicyPatch backup policy Details for create and update -type BackupPolicyPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // BackupPolicyProperties - Backup policy Properties - *BackupPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicyPatch. -func (bpp BackupPolicyPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bpp.Location != nil { - objectMap["location"] = bpp.Location - } - if bpp.Tags != nil { - objectMap["tags"] = bpp.Tags - } - if bpp.BackupPolicyProperties != nil { - objectMap["properties"] = bpp.BackupPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for BackupPolicyPatch struct. -func (bpp *BackupPolicyPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - bpp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - bpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - bpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - bpp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - bpp.Tags = tags - } - case "properties": - if v != nil { - var backupPolicyProperties BackupPolicyProperties - err = json.Unmarshal(*v, &backupPolicyProperties) - if err != nil { - return err - } - bpp.BackupPolicyProperties = &backupPolicyProperties - } - } - } - - return nil -} - -// BackupPolicyProperties backup policy properties -type BackupPolicyProperties struct { - // BackupPolicyID - READ-ONLY; Backup Policy Resource ID - BackupPolicyID *string `json:"backupPolicyId,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // DailyBackupsToKeep - Daily backups count to keep - DailyBackupsToKeep *int32 `json:"dailyBackupsToKeep,omitempty"` - // WeeklyBackupsToKeep - Weekly backups count to keep - WeeklyBackupsToKeep *int32 `json:"weeklyBackupsToKeep,omitempty"` - // MonthlyBackupsToKeep - Monthly backups count to keep - MonthlyBackupsToKeep *int32 `json:"monthlyBackupsToKeep,omitempty"` - // VolumesAssigned - READ-ONLY; Volumes using current backup policy - VolumesAssigned *int32 `json:"volumesAssigned,omitempty"` - // Enabled - The property to decide policy is enabled or not - Enabled *bool `json:"enabled,omitempty"` - // VolumeBackups - READ-ONLY; A list of volumes assigned to this policy - VolumeBackups *[]VolumeBackups `json:"volumeBackups,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupPolicyProperties. -func (bpp BackupPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bpp.DailyBackupsToKeep != nil { - objectMap["dailyBackupsToKeep"] = bpp.DailyBackupsToKeep - } - if bpp.WeeklyBackupsToKeep != nil { - objectMap["weeklyBackupsToKeep"] = bpp.WeeklyBackupsToKeep - } - if bpp.MonthlyBackupsToKeep != nil { - objectMap["monthlyBackupsToKeep"] = bpp.MonthlyBackupsToKeep - } - if bpp.Enabled != nil { - objectMap["enabled"] = bpp.Enabled - } - return json.Marshal(objectMap) -} - -// BackupProperties backup properties -type BackupProperties struct { - // BackupID - READ-ONLY; UUID v4 used to identify the Backup - BackupID *string `json:"backupId,omitempty"` - // CreationDate - READ-ONLY; The creation date of the backup - CreationDate *date.Time `json:"creationDate,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // Size - READ-ONLY; Size of backup - Size *int64 `json:"size,omitempty"` - // Label - Label for backup - Label *string `json:"label,omitempty"` - // BackupType - READ-ONLY; Type of backup Manual or Scheduled. Possible values include: 'BackupTypeManual', 'BackupTypeScheduled' - BackupType BackupType `json:"backupType,omitempty"` - // FailureReason - READ-ONLY; Failure reason - FailureReason *string `json:"failureReason,omitempty"` - // VolumeName - READ-ONLY; Volume name - VolumeName *string `json:"volumeName,omitempty"` - // UseExistingSnapshot - Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups - UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupProperties. -func (bp BackupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if bp.Label != nil { - objectMap["label"] = bp.Label - } - if bp.UseExistingSnapshot != nil { - objectMap["useExistingSnapshot"] = bp.UseExistingSnapshot - } - return json.Marshal(objectMap) -} - -// BackupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupsClient) (Backup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupsCreateFuture.Result. -func (future *BackupsCreateFuture) result(client BackupsClient) (b Backup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - b.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { - b, err = client.CreateResponder(b.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsCreateFuture", "Result", b.Response.Response, "Failure responding to request") - } - } - return -} - -// BackupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupsDeleteFuture.Result. -func (future *BackupsDeleteFuture) result(client BackupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// BackupsList list of Backups -type BackupsList struct { - autorest.Response `json:"-"` - // Value - A list of Backups - Value *[]Backup `json:"value,omitempty"` -} - -// BackupStatus backup status -type BackupStatus struct { - autorest.Response `json:"-"` - // Healthy - READ-ONLY; Backup health status - Healthy *bool `json:"healthy,omitempty"` - // RelationshipStatus - READ-ONLY; Status of the backup mirror relationship. Possible values include: 'RelationshipStatusIdle', 'RelationshipStatusTransferring' - RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` - // MirrorState - READ-ONLY; The status of the backup. Possible values include: 'MirrorStateUninitialized', 'MirrorStateMirrored', 'MirrorStateBroken' - MirrorState MirrorState `json:"mirrorState,omitempty"` - // UnhealthyReason - READ-ONLY; Reason for the unhealthy backup relationship - UnhealthyReason *string `json:"unhealthyReason,omitempty"` - // ErrorMessage - READ-ONLY; Displays error message if the backup is in an error state - ErrorMessage *string `json:"errorMessage,omitempty"` - // LastTransferSize - READ-ONLY; Displays the last transfer size - LastTransferSize *int64 `json:"lastTransferSize,omitempty"` - // LastTransferType - READ-ONLY; Displays the last transfer type - LastTransferType *string `json:"lastTransferType,omitempty"` - // TotalTransferBytes - READ-ONLY; Displays the total bytes transferred - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` -} - -// MarshalJSON is the custom marshaler for BackupStatus. -func (bs BackupStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// BackupsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type BackupsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(BackupsClient) (Backup, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *BackupsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for BackupsUpdateFuture.Result. -func (future *BackupsUpdateFuture) result(client BackupsClient) (b Backup, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - b.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.BackupsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if b.Response.Response, err = future.GetResult(sender); err == nil && b.Response.Response.StatusCode != http.StatusNoContent { - b, err = client.UpdateResponder(b.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.BackupsUpdateFuture", "Result", b.Response.Response, "Failure responding to request") - } - } - return -} - -// BreakReplicationRequest break replication request -type BreakReplicationRequest struct { - // ForceBreakReplication - If replication is in status transferring and you want to force break the replication, set to true - ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` -} - -// CapacityPool capacity pool resource -type CapacityPool struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // PoolProperties - Capacity pool properties - *PoolProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapacityPool. -func (cp CapacityPool) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cp.Location != nil { - objectMap["location"] = cp.Location - } - if cp.Tags != nil { - objectMap["tags"] = cp.Tags - } - if cp.PoolProperties != nil { - objectMap["properties"] = cp.PoolProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CapacityPool struct. -func (cp *CapacityPool) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - cp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cp.Tags = tags - } - case "properties": - if v != nil { - var poolProperties PoolProperties - err = json.Unmarshal(*v, &poolProperties) - if err != nil { - return err - } - cp.PoolProperties = &poolProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - cp.SystemData = &systemData - } - } - } - - return nil -} - -// CapacityPoolList list of capacity pool resources -type CapacityPoolList struct { - autorest.Response `json:"-"` - // Value - List of Capacity pools - Value *[]CapacityPool `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// CapacityPoolListIterator provides access to a complete listing of CapacityPool values. -type CapacityPoolListIterator struct { - i int - page CapacityPoolListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *CapacityPoolListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *CapacityPoolListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter CapacityPoolListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter CapacityPoolListIterator) Response() CapacityPoolList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter CapacityPoolListIterator) Value() CapacityPool { - if !iter.page.NotDone() { - return CapacityPool{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the CapacityPoolListIterator type. -func NewCapacityPoolListIterator(page CapacityPoolListPage) CapacityPoolListIterator { - return CapacityPoolListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (cpl CapacityPoolList) IsEmpty() bool { - return cpl.Value == nil || len(*cpl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (cpl CapacityPoolList) hasNextLink() bool { - return cpl.NextLink != nil && len(*cpl.NextLink) != 0 -} - -// capacityPoolListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (cpl CapacityPoolList) capacityPoolListPreparer(ctx context.Context) (*http.Request, error) { - if !cpl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(cpl.NextLink))) -} - -// CapacityPoolListPage contains a page of CapacityPool values. -type CapacityPoolListPage struct { - fn func(context.Context, CapacityPoolList) (CapacityPoolList, error) - cpl CapacityPoolList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *CapacityPoolListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/CapacityPoolListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.cpl) - if err != nil { - return err - } - page.cpl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *CapacityPoolListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page CapacityPoolListPage) NotDone() bool { - return !page.cpl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page CapacityPoolListPage) Response() CapacityPoolList { - return page.cpl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page CapacityPoolListPage) Values() []CapacityPool { - if page.cpl.IsEmpty() { - return nil - } - return *page.cpl.Value -} - -// Creates a new instance of the CapacityPoolListPage type. -func NewCapacityPoolListPage(cur CapacityPoolList, getNextPage func(context.Context, CapacityPoolList) (CapacityPoolList, error)) CapacityPoolListPage { - return CapacityPoolListPage{ - fn: getNextPage, - cpl: cur, - } -} - -// CapacityPoolPatch capacity pool patch resource -type CapacityPoolPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // PoolPatchProperties - Capacity pool properties - *PoolPatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for CapacityPoolPatch. -func (cpp CapacityPoolPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if cpp.Location != nil { - objectMap["location"] = cpp.Location - } - if cpp.Tags != nil { - objectMap["tags"] = cpp.Tags - } - if cpp.PoolPatchProperties != nil { - objectMap["properties"] = cpp.PoolPatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for CapacityPoolPatch struct. -func (cpp *CapacityPoolPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - cpp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - cpp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - cpp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - cpp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - cpp.Tags = tags - } - case "properties": - if v != nil { - var poolPatchProperties PoolPatchProperties - err = json.Unmarshal(*v, &poolPatchProperties) - if err != nil { - return err - } - cpp.PoolPatchProperties = &poolPatchProperties - } - } - } - - return nil -} - -// CheckAvailabilityResponse information regarding availability of a resource. -type CheckAvailabilityResponse struct { - autorest.Response `json:"-"` - // IsAvailable - true indicates name is valid and available. false indicates the name is invalid, unavailable, or both. - IsAvailable *bool `json:"isAvailable,omitempty"` - // Reason - Invalid indicates the name provided does not match Azure App Service naming requirements. AlreadyExists indicates that the name is already in use and is therefore unavailable. Possible values include: 'InAvailabilityReasonTypeInvalid', 'InAvailabilityReasonTypeAlreadyExists' - Reason InAvailabilityReasonType `json:"reason,omitempty"` - // Message - If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. - Message *string `json:"message,omitempty"` -} - -// CloudError an error response from the service. -type CloudError struct { - // Error - Cloud error body. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody an error response from the service. -type CloudErrorBody struct { - // Code - An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - Code *string `json:"code,omitempty"` - // Message - A message describing the error, intended to be suitable for display in a user interface. - Message *string `json:"message,omitempty"` -} - -// DailySchedule daily Schedule properties -type DailySchedule struct { - // SnapshotsToKeep - Daily snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // Hour - Indicates which hour in UTC timezone a snapshot should be taken - Hour *int32 `json:"hour,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} - -// Dimension dimension of blobs, possibly be blob type or access tier. -type Dimension struct { - // Name - Display name of dimension. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of dimension. - DisplayName *string `json:"displayName,omitempty"` -} - -// ExportPolicyRule volume Export Policy Rule -type ExportPolicyRule struct { - // RuleIndex - Order index - RuleIndex *int32 `json:"ruleIndex,omitempty"` - // UnixReadOnly - Read only access - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - // UnixReadWrite - Read and write access - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` - // Kerberos5ReadOnly - Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - // Kerberos5ReadWrite - Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - // Kerberos5iReadOnly - Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - // Kerberos5iReadWrite - Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - // Kerberos5pReadOnly - Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - // Kerberos5pReadWrite - Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - // Cifs - Allows CIFS protocol - Cifs *bool `json:"cifs,omitempty"` - // Nfsv3 - Allows NFSv3 protocol. Enable only for NFSv3 type volumes - Nfsv3 *bool `json:"nfsv3,omitempty"` - // Nfsv41 - Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes - 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"` - // HasRootAccess - Has root access to volume - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - // ChownMode - This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. Possible values include: 'ChownModeRestricted', 'ChownModeUnrestricted' - ChownMode ChownMode `json:"chownMode,omitempty"` -} - -// FilePathAvailabilityRequest file path availability request content - availability is based on the name -// and the subnetId. -type FilePathAvailabilityRequest struct { - // Name - File path to verify. - Name *string `json:"name,omitempty"` - // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes - SubnetID *string `json:"subnetId,omitempty"` -} - -// HourlySchedule hourly Schedule properties -type HourlySchedule struct { - // SnapshotsToKeep - Hourly snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} - -// LdapSearchScopeOpt LDAP search scope -type LdapSearchScopeOpt struct { - // UserDN - This specifies the user DN, which overrides the base DN for user lookups. - UserDN *string `json:"userDN,omitempty"` - // GroupDN - This specifies the group DN, which overrides the base DN for group lookups. - GroupDN *string `json:"groupDN,omitempty"` - // GroupMembershipFilter - This specifies the custom LDAP search filter to be used when looking up group membership from LDAP server. - GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` -} - -// LogSpecification log Definition of a single resource metric. -type LogSpecification struct { - // Name - Name of log specification. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of log specification. - DisplayName *string `json:"displayName,omitempty"` -} - -// MetricSpecification metric specification of operation. -type MetricSpecification struct { - // Name - Name of metric specification. - Name *string `json:"name,omitempty"` - // DisplayName - Display name of metric specification. - DisplayName *string `json:"displayName,omitempty"` - // DisplayDescription - Display description of metric specification. - DisplayDescription *string `json:"displayDescription,omitempty"` - // Unit - Unit could be Bytes or Count. - Unit *string `json:"unit,omitempty"` - // SupportedAggregationTypes - Support metric aggregation type. - SupportedAggregationTypes *[]MetricAggregationType `json:"supportedAggregationTypes,omitempty"` - // SupportedTimeGrainTypes - The supported time grain types for the metrics. - SupportedTimeGrainTypes *[]string `json:"supportedTimeGrainTypes,omitempty"` - // InternalMetricName - The internal metric name. - InternalMetricName *string `json:"internalMetricName,omitempty"` - // EnableRegionalMdmAccount - Whether or not the service is using regional MDM accounts. - EnableRegionalMdmAccount *bool `json:"enableRegionalMdmAccount,omitempty"` - // SourceMdmAccount - The source MDM account. - SourceMdmAccount *string `json:"sourceMdmAccount,omitempty"` - // SourceMdmNamespace - The source MDM namespace. - SourceMdmNamespace *string `json:"sourceMdmNamespace,omitempty"` - // Dimensions - Dimensions of blobs, including blob type and access tier. - Dimensions *[]Dimension `json:"dimensions,omitempty"` - // AggregationType - Aggregation type could be Average. - AggregationType *string `json:"aggregationType,omitempty"` - // FillGapWithZero - The property to decide fill gap with zero or not. - FillGapWithZero *bool `json:"fillGapWithZero,omitempty"` - // Category - The category this metric specification belong to, could be Capacity. - Category *string `json:"category,omitempty"` - // ResourceIDDimensionNameOverride - Account Resource Id. - ResourceIDDimensionNameOverride *string `json:"resourceIdDimensionNameOverride,omitempty"` - // IsInternal - Whether the metric is internal. - IsInternal *bool `json:"isInternal,omitempty"` -} - -// MonthlySchedule monthly Schedule properties -type MonthlySchedule struct { - // SnapshotsToKeep - Monthly snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // DaysOfMonth - Indicates which days of the month snapshot should be taken. A comma delimited string. - DaysOfMonth *string `json:"daysOfMonth,omitempty"` - // Hour - Indicates which hour in UTC timezone a snapshot should be taken - Hour *int32 `json:"hour,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} - -// MountTarget mount Target -type MountTarget struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // MountTargetProperties - Mount Target Properties - *MountTargetProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for MountTarget. -func (mt MountTarget) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mt.Location != nil { - objectMap["location"] = mt.Location - } - if mt.Tags != nil { - objectMap["tags"] = mt.Tags - } - if mt.MountTargetProperties != nil { - objectMap["properties"] = mt.MountTargetProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for MountTarget struct. -func (mt *MountTarget) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - mt.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - mt.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - 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 map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - mt.Tags = tags - } - case "properties": - if v != nil { - var mountTargetProperties MountTargetProperties - err = json.Unmarshal(*v, &mountTargetProperties) - if err != nil { - return err - } - mt.MountTargetProperties = &mountTargetProperties - } - } - } - - return nil -} - -// MountTargetProperties mount target properties -type MountTargetProperties struct { - // MountTargetID - READ-ONLY; UUID v4 used to identify the MountTarget - MountTargetID *string `json:"mountTargetId,omitempty"` - // FileSystemID - UUID v4 used to identify the MountTarget - FileSystemID *string `json:"fileSystemId,omitempty"` - // IPAddress - READ-ONLY; The mount target's IPv4 address - IPAddress *string `json:"ipAddress,omitempty"` - // SmbServerFqdn - The SMB server's Fully Qualified Domain Name, FQDN - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} - -// MarshalJSON is the custom marshaler for MountTargetProperties. -func (mtp MountTargetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if mtp.FileSystemID != nil { - objectMap["fileSystemId"] = mtp.FileSystemID - } - if mtp.SmbServerFqdn != nil { - objectMap["smbServerFqdn"] = mtp.SmbServerFqdn - } - return json.Marshal(objectMap) -} - -// Operation microsoft.NetApp REST API operation definition. -type Operation struct { - // Name - Operation name: {provider}/{resource}/{operation} - Name *string `json:"name,omitempty"` - // Display - Display metadata associated with the operation. - Display *OperationDisplay `json:"display,omitempty"` - // Origin - The origin of operations. - Origin *string `json:"origin,omitempty"` - // OperationProperties - Properties of operation, include metric specifications. - *OperationProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Operation. -func (o Operation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if o.Name != nil { - objectMap["name"] = o.Name - } - if o.Display != nil { - objectMap["display"] = o.Display - } - if o.Origin != nil { - objectMap["origin"] = o.Origin - } - if o.OperationProperties != nil { - objectMap["properties"] = o.OperationProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Operation struct. -func (o *Operation) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - o.Name = &name - } - case "display": - if v != nil { - var display OperationDisplay - err = json.Unmarshal(*v, &display) - if err != nil { - return err - } - o.Display = &display - } - case "origin": - if v != nil { - var origin string - err = json.Unmarshal(*v, &origin) - if err != nil { - return err - } - o.Origin = &origin - } - case "properties": - if v != nil { - var operationProperties OperationProperties - err = json.Unmarshal(*v, &operationProperties) - if err != nil { - return err - } - o.OperationProperties = &operationProperties - } - } - } - - return nil -} - -// OperationDisplay display metadata associated with the operation. -type OperationDisplay struct { - // Provider - Service provider: Microsoft NetApp. - Provider *string `json:"provider,omitempty"` - // Resource - Resource on which the operation is performed etc. - Resource *string `json:"resource,omitempty"` - // Operation - Type of operation: get, read, delete, etc. - Operation *string `json:"operation,omitempty"` - // Description - Operation description. - Description *string `json:"description,omitempty"` -} - -// OperationListResult result of the request to list Cloud Volume operations. It contains a list of -// operations and a URL link to get the next set of results. -type OperationListResult struct { - autorest.Response `json:"-"` - // Value - List of Storage operations supported by the Storage resource provider. - Value *[]Operation `json:"value,omitempty"` -} - -// OperationProperties properties of operation, include metric specifications. -type OperationProperties struct { - // ServiceSpecification - One property of operation, include metric specifications. - ServiceSpecification *ServiceSpecification `json:"serviceSpecification,omitempty"` -} - -// PlacementKeyValuePairs application specific parameters for the placement of volumes in the volume group -type PlacementKeyValuePairs struct { - // Key - Key for an application specific parameter for the placement of volumes in the volume group - Key *string `json:"key,omitempty"` - // Value - Value for an application specific parameter for the placement of volumes in the volume group - Value *string `json:"value,omitempty"` -} - -// PoolChangeRequest pool change request -type PoolChangeRequest struct { - // NewPoolResourceID - Resource id of the pool to move volume to - NewPoolResourceID *string `json:"newPoolResourceId,omitempty"` -} - -// PoolPatchProperties patchable pool properties -type PoolPatchProperties struct { - // Size - Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiply of 4398046511104). - Size *int64 `json:"size,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' - QosType QosType `json:"qosType,omitempty"` -} - -// PoolProperties pool properties -type PoolProperties struct { - // PoolID - READ-ONLY; UUID v4 used to identify the Pool - PoolID *string `json:"poolId,omitempty"` - // Size - Provisioned size of the pool (in bytes). Allowed values are in 1TiB chunks (value must be multiply of 4398046511104). - Size *int64 `json:"size,omitempty"` - // ServiceLevel - Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra', 'ServiceLevelStandardZRS' - ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // TotalThroughputMibps - READ-ONLY; Total throughput of pool in Mibps - TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` - // UtilizedThroughputMibps - READ-ONLY; Utilized throughput of pool in Mibps - UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` - // QosType - The qos type of the pool. Possible values include: 'QosTypeAuto', 'QosTypeManual' - QosType QosType `json:"qosType,omitempty"` - // CoolAccess - If enabled (true) the pool can contain cool Access enabled volumes. - CoolAccess *bool `json:"coolAccess,omitempty"` - // EncryptionType - Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. Possible values include: 'EncryptionTypeSingle', 'EncryptionTypeDouble' - EncryptionType EncryptionType `json:"encryptionType,omitempty"` -} - -// MarshalJSON is the custom marshaler for PoolProperties. -func (pp PoolProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if pp.Size != nil { - objectMap["size"] = pp.Size - } - if pp.ServiceLevel != "" { - objectMap["serviceLevel"] = pp.ServiceLevel - } - if pp.QosType != "" { - objectMap["qosType"] = pp.QosType - } - if pp.CoolAccess != nil { - objectMap["coolAccess"] = pp.CoolAccess - } - if pp.EncryptionType != "" { - objectMap["encryptionType"] = pp.EncryptionType - } - return json.Marshal(objectMap) -} - -// PoolsCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type PoolsCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolsClient) (CapacityPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolsCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolsCreateOrUpdateFuture.Result. -func (future *PoolsCreateOrUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.PoolsCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { - cp, err = client.CreateOrUpdateResponder(cp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsCreateOrUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") - } - } - return -} - -// PoolsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type PoolsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolsDeleteFuture.Result. -func (future *PoolsDeleteFuture) result(client PoolsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.PoolsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// PoolsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running operation. -type PoolsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(PoolsClient) (CapacityPool, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *PoolsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for PoolsUpdateFuture.Result. -func (future *PoolsUpdateFuture) result(client PoolsClient) (cp CapacityPool, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - cp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.PoolsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if cp.Response.Response, err = future.GetResult(sender); err == nil && cp.Response.Response.StatusCode != http.StatusNoContent { - cp, err = client.UpdateResponder(cp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsUpdateFuture", "Result", cp.Response.Response, "Failure responding to request") - } - } - return -} - -// ProxyResource the resource model definition for a Azure Resource Manager proxy resource. It will not -// have tags and a location -type ProxyResource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ProxyResource. -func (pr ProxyResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// QuotaAvailabilityRequest quota availability request content. -type QuotaAvailabilityRequest struct { - // Name - Name of the resource to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. Possible values include: 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccounts', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'CheckQuotaNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' - Type CheckQuotaNameResourceTypes `json:"type,omitempty"` - // ResourceGroup - Resource group name. - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// 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: 'EndpointTypeSrc', 'EndpointTypeDst' - EndpointType EndpointType `json:"endpointType,omitempty"` - // ReplicationSchedule - Schedule. Possible values include: 'ReplicationSchedule10minutely', 'ReplicationScheduleHourly', 'ReplicationScheduleDaily' - 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: 'RelationshipStatusIdle', 'RelationshipStatusTransferring' - RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` - // MirrorState - The status of the replication. Possible values include: 'MirrorStateUninitialized', 'MirrorStateMirrored', 'MirrorStateBroken' - 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"` -} - -// Resource common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ResourceIdentity identity for the resource. -type ResourceIdentity struct { - // PrincipalID - READ-ONLY; Object id of the identity resource - PrincipalID *string `json:"principalId,omitempty"` - // TenantID - READ-ONLY; The tenant id of the resource - TenantID *string `json:"tenantId,omitempty"` - // Type - Type of Identity. Supported values are: 'None', 'SystemAssigned' - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for ResourceIdentity. -func (ri ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if ri.Type != nil { - objectMap["type"] = ri.Type - } - return json.Marshal(objectMap) -} - -// ResourceNameAvailabilityRequest resource name availability request content. -type ResourceNameAvailabilityRequest struct { - // Name - Resource name to verify. - Name *string `json:"name,omitempty"` - // Type - Resource type used for verification. Possible values include: 'CheckNameResourceTypesMicrosoftNetAppnetAppAccounts', 'CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPools', 'CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumes', 'CheckNameResourceTypesMicrosoftNetAppnetAppAccountscapacityPoolsvolumessnapshots' - Type CheckNameResourceTypes `json:"type,omitempty"` - // ResourceGroup - Resource group name. - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// RestoreStatus restore status -type RestoreStatus struct { - autorest.Response `json:"-"` - // Healthy - READ-ONLY; Restore health status - Healthy *bool `json:"healthy,omitempty"` - // RelationshipStatus - READ-ONLY; Status of the restore SnapMirror relationship. Possible values include: 'RelationshipStatusIdle', 'RelationshipStatusTransferring' - RelationshipStatus RelationshipStatus `json:"relationshipStatus,omitempty"` - // MirrorState - READ-ONLY; The status of the restore. Possible values include: 'MirrorStateUninitialized', 'MirrorStateMirrored', 'MirrorStateBroken' - MirrorState MirrorState `json:"mirrorState,omitempty"` - // UnhealthyReason - READ-ONLY; Reason for the unhealthy restore relationship - UnhealthyReason *string `json:"unhealthyReason,omitempty"` - // ErrorMessage - READ-ONLY; Displays error message if the restore is in an error state - ErrorMessage *string `json:"errorMessage,omitempty"` - // TotalTransferBytes - READ-ONLY; Displays the total bytes transferred - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` -} - -// MarshalJSON is the custom marshaler for RestoreStatus. -func (rs RestoreStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// ServiceSpecification one property of operation, include metric specifications. -type ServiceSpecification struct { - // MetricSpecifications - Metric specifications of operation. - MetricSpecifications *[]MetricSpecification `json:"metricSpecifications,omitempty"` - // LogSpecifications - Log specification of operation. - LogSpecifications *[]LogSpecification `json:"logSpecifications,omitempty"` -} - -// Snapshot snapshot of a Volume -type Snapshot struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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"` - // SnapshotProperties - Snapshot Properties - *SnapshotProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Snapshot. -func (s Snapshot) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if s.Location != nil { - objectMap["location"] = s.Location - } - if s.SnapshotProperties != nil { - objectMap["properties"] = s.SnapshotProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Snapshot struct. -func (s *Snapshot) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - s.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - s.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - s.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - s.Type = &typeVar - } - case "properties": - if v != nil { - var snapshotProperties SnapshotProperties - err = json.Unmarshal(*v, &snapshotProperties) - if err != nil { - return err - } - s.SnapshotProperties = &snapshotProperties - } - } - } - - return nil -} - -// SnapshotPoliciesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotPoliciesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotPoliciesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotPoliciesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotPoliciesDeleteFuture.Result. -func (future *SnapshotPoliciesDeleteFuture) result(client SnapshotPoliciesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SnapshotPoliciesList list of Snapshot Policies -type SnapshotPoliciesList struct { - autorest.Response `json:"-"` - // Value - A list of snapshot policies - Value *[]SnapshotPolicy `json:"value,omitempty"` -} - -// SnapshotPoliciesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotPoliciesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotPoliciesClient) (SnapshotPolicy, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotPoliciesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotPoliciesUpdateFuture.Result. -func (future *SnapshotPoliciesUpdateFuture) result(client SnapshotPoliciesClient) (sp SnapshotPolicy, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sp.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotPoliciesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sp.Response.Response, err = future.GetResult(sender); err == nil && sp.Response.Response.StatusCode != http.StatusNoContent { - sp, err = client.UpdateResponder(sp.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesUpdateFuture", "Result", sp.Response.Response, "Failure responding to request") - } - } - return -} - -// SnapshotPolicy snapshot policy information -type SnapshotPolicy struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // SnapshotPolicyProperties - Snapshot policy Properties - *SnapshotPolicyProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicy. -func (sp SnapshotPolicy) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Location != nil { - objectMap["location"] = sp.Location - } - if sp.Tags != nil { - objectMap["tags"] = sp.Tags - } - if sp.SnapshotPolicyProperties != nil { - objectMap["properties"] = sp.SnapshotPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SnapshotPolicy struct. -func (sp *SnapshotPolicy) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - sp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sp.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - sp.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - sp.Tags = tags - } - case "properties": - if v != nil { - var snapshotPolicyProperties SnapshotPolicyProperties - err = json.Unmarshal(*v, &snapshotPolicyProperties) - if err != nil { - return err - } - sp.SnapshotPolicyProperties = &snapshotPolicyProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sp.SystemData = &systemData - } - } - } - - return nil -} - -// SnapshotPolicyDetails snapshot policy properties -type SnapshotPolicyDetails struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // SnapshotPolicyProperties - Snapshot policy Properties - *SnapshotPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicyDetails. -func (spd SnapshotPolicyDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spd.Location != nil { - objectMap["location"] = spd.Location - } - if spd.Tags != nil { - objectMap["tags"] = spd.Tags - } - if spd.SnapshotPolicyProperties != nil { - objectMap["properties"] = spd.SnapshotPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyDetails struct. -func (spd *SnapshotPolicyDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spd.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spd.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spd.Tags = tags - } - case "properties": - if v != nil { - var snapshotPolicyProperties SnapshotPolicyProperties - err = json.Unmarshal(*v, &snapshotPolicyProperties) - if err != nil { - return err - } - spd.SnapshotPolicyProperties = &snapshotPolicyProperties - } - } - } - - return nil -} - -// SnapshotPolicyPatch snapshot policy Details for create and update -type SnapshotPolicyPatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // SnapshotPolicyProperties - Snapshot Policy properties - *SnapshotPolicyProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicyPatch. -func (spp SnapshotPolicyPatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.Location != nil { - objectMap["location"] = spp.Location - } - if spp.Tags != nil { - objectMap["tags"] = spp.Tags - } - if spp.SnapshotPolicyProperties != nil { - objectMap["properties"] = spp.SnapshotPolicyProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SnapshotPolicyPatch struct. -func (spp *SnapshotPolicyPatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - spp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - spp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - spp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - spp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - spp.Tags = tags - } - case "properties": - if v != nil { - var snapshotPolicyProperties SnapshotPolicyProperties - err = json.Unmarshal(*v, &snapshotPolicyProperties) - if err != nil { - return err - } - spp.SnapshotPolicyProperties = &snapshotPolicyProperties - } - } - } - - return nil -} - -// SnapshotPolicyProperties snapshot policy properties -type SnapshotPolicyProperties struct { - // HourlySchedule - Schedule for hourly snapshots - HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` - // DailySchedule - Schedule for daily snapshots - DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` - // WeeklySchedule - Schedule for weekly snapshots - WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` - // MonthlySchedule - Schedule for monthly snapshots - MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` - // Enabled - The property to decide policy is enabled or not - Enabled *bool `json:"enabled,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SnapshotPolicyProperties. -func (spp SnapshotPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spp.HourlySchedule != nil { - objectMap["hourlySchedule"] = spp.HourlySchedule - } - if spp.DailySchedule != nil { - objectMap["dailySchedule"] = spp.DailySchedule - } - if spp.WeeklySchedule != nil { - objectMap["weeklySchedule"] = spp.WeeklySchedule - } - if spp.MonthlySchedule != nil { - objectMap["monthlySchedule"] = spp.MonthlySchedule - } - if spp.Enabled != nil { - objectMap["enabled"] = spp.Enabled - } - return json.Marshal(objectMap) -} - -// SnapshotPolicyVolumeList volumes associated with snapshot policy -type SnapshotPolicyVolumeList struct { - autorest.Response `json:"-"` - // Value - List of volumes - Value *[]Volume `json:"value,omitempty"` -} - -// SnapshotProperties snapshot properties -type SnapshotProperties struct { - // SnapshotID - READ-ONLY; UUID v4 used to identify the Snapshot - SnapshotID *string `json:"snapshotId,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"` -} - -// MarshalJSON is the custom marshaler for SnapshotProperties. -func (sp SnapshotProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SnapshotRestoreFiles restore payload for Single File Snapshot Restore -type SnapshotRestoreFiles struct { - // FilePaths - List of files to be restored - FilePaths *[]string `json:"filePaths,omitempty"` - // DestinationPath - Destination folder where the files will be restored - DestinationPath *string `json:"destinationPath,omitempty"` -} - -// SnapshotsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (Snapshot, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsCreateFuture.Result. -func (future *SnapshotsCreateFuture) result(client SnapshotsClient) (s Snapshot, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.CreateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsCreateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SnapshotsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsDeleteFuture.Result. -func (future *SnapshotsDeleteFuture) result(client SnapshotsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SnapshotsList list of Snapshots -type SnapshotsList struct { - autorest.Response `json:"-"` - // Value - A list of Snapshots - Value *[]Snapshot `json:"value,omitempty"` -} - -// SnapshotsRestoreFilesFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsRestoreFilesFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsRestoreFilesFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsRestoreFilesFuture.Result. -func (future *SnapshotsRestoreFilesFuture) result(client SnapshotsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsRestoreFilesFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsRestoreFilesFuture") - return - } - ar.Response = future.Response() - return -} - -// SnapshotsUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SnapshotsUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SnapshotsClient) (Snapshot, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SnapshotsUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SnapshotsUpdateFuture.Result. -func (future *SnapshotsUpdateFuture) result(client SnapshotsClient) (s Snapshot, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - s.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SnapshotsUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if s.Response.Response, err = future.GetResult(sender); err == nil && s.Response.Response.StatusCode != http.StatusNoContent { - s, err = client.UpdateResponder(s.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsUpdateFuture", "Result", s.Response.Response, "Failure responding to request") - } - } - return -} - -// SubscriptionQuotaItem information regarding Subscription Quota Item. -type SubscriptionQuotaItem struct { - autorest.Response `json:"-"` - // SubscriptionQuotaItemProperties - SubscriptionQuotaItem properties - *SubscriptionQuotaItemProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionQuotaItem. -func (sqi SubscriptionQuotaItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sqi.SubscriptionQuotaItemProperties != nil { - objectMap["properties"] = sqi.SubscriptionQuotaItemProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubscriptionQuotaItem struct. -func (sqi *SubscriptionQuotaItem) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subscriptionQuotaItemProperties SubscriptionQuotaItemProperties - err = json.Unmarshal(*v, &subscriptionQuotaItemProperties) - if err != nil { - return err - } - sqi.SubscriptionQuotaItemProperties = &subscriptionQuotaItemProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - sqi.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sqi.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sqi.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sqi.Type = &typeVar - } - } - } - - return nil -} - -// SubscriptionQuotaItemList list of Subscription Quota Items -type SubscriptionQuotaItemList struct { - autorest.Response `json:"-"` - // Value - A list of SubscriptionQuotaItems - Value *[]SubscriptionQuotaItem `json:"value,omitempty"` -} - -// SubscriptionQuotaItemProperties subscriptionQuotaItem Properties -type SubscriptionQuotaItemProperties struct { - // Current - READ-ONLY; The current quota value. - Current *int32 `json:"current,omitempty"` - // Default - READ-ONLY; The default quota value. - Default *int32 `json:"default,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubscriptionQuotaItemProperties. -func (sqip SubscriptionQuotaItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - return json.Marshal(objectMap) -} - -// SubvolumeInfo subvolume Information properties -type SubvolumeInfo struct { - autorest.Response `json:"-"` - // SubvolumeProperties - Subvolume Properties - *SubvolumeProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumeInfo. -func (si SubvolumeInfo) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if si.SubvolumeProperties != nil { - objectMap["properties"] = si.SubvolumeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubvolumeInfo struct. -func (si *SubvolumeInfo) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subvolumeProperties SubvolumeProperties - err = json.Unmarshal(*v, &subvolumeProperties) - if err != nil { - return err - } - si.SubvolumeProperties = &subvolumeProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - si.SystemData = &systemData - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - si.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - si.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - si.Type = &typeVar - } - } - } - - return nil -} - -// SubvolumeModel result of the post subvolume and action is to get metadata of the subvolume. -type SubvolumeModel struct { - autorest.Response `json:"-"` - // ID - READ-ONLY; Resource Id - 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"` - // SubvolumeModelProperties - It represents the minimal properties of the subvolume. - *SubvolumeModelProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumeModel. -func (sm SubvolumeModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sm.SubvolumeModelProperties != nil { - objectMap["properties"] = sm.SubvolumeModelProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubvolumeModel struct. -func (sm *SubvolumeModel) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - sm.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - sm.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - sm.Type = &typeVar - } - case "properties": - if v != nil { - var subvolumeModelProperties SubvolumeModelProperties - err = json.Unmarshal(*v, &subvolumeModelProperties) - if err != nil { - return err - } - sm.SubvolumeModelProperties = &subvolumeModelProperties - } - } - } - - return nil -} - -// SubvolumeModelProperties properties which represents actual subvolume model which is stored as a file in -// the system. -type SubvolumeModelProperties struct { - // Path - Path to the subvolume - Path *string `json:"path,omitempty"` - // ParentPath - Path to the parent subvolume - ParentPath *string `json:"parentPath,omitempty"` - // Size - Size of subvolume - Size *int64 `json:"size,omitempty"` - // BytesUsed - Bytes used - BytesUsed *int64 `json:"bytesUsed,omitempty"` - // Permissions - Permissions of the subvolume - Permissions *string `json:"permissions,omitempty"` - // CreationTimeStamp - Creation time and date - CreationTimeStamp *date.Time `json:"creationTimeStamp,omitempty"` - // AccessedTimeStamp - Most recent access time and date - AccessedTimeStamp *date.Time `json:"accessedTimeStamp,omitempty"` - // ModifiedTimeStamp - Most recent modification time and date - ModifiedTimeStamp *date.Time `json:"modifiedTimeStamp,omitempty"` - // ChangedTimeStamp - Most recent change time and date - ChangedTimeStamp *date.Time `json:"changedTimeStamp,omitempty"` - // ProvisioningState - Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// SubvolumePatchParams parameters with which a subvolume can be updated -type SubvolumePatchParams struct { - // Size - Truncate subvolume to the provided size in bytes - Size *int64 `json:"size,omitempty"` - // Path - path to the subvolume - Path *string `json:"path,omitempty"` -} - -// SubvolumePatchRequest subvolume Patch Request properties -type SubvolumePatchRequest struct { - // SubvolumePatchParams - Subvolume Properties - *SubvolumePatchParams `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumePatchRequest. -func (spr SubvolumePatchRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if spr.SubvolumePatchParams != nil { - objectMap["properties"] = spr.SubvolumePatchParams - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for SubvolumePatchRequest struct. -func (spr *SubvolumePatchRequest) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "properties": - if v != nil { - var subvolumePatchParams SubvolumePatchParams - err = json.Unmarshal(*v, &subvolumePatchParams) - if err != nil { - return err - } - spr.SubvolumePatchParams = &subvolumePatchParams - } - } - } - - return nil -} - -// SubvolumeProperties this represents path associated with the subvolume -type SubvolumeProperties struct { - // Path - Path to the subvolume - Path *string `json:"path,omitempty"` - // Size - Truncate subvolume to the provided size in bytes - Size *int64 `json:"size,omitempty"` - // ParentPath - parent path to the subvolume - ParentPath *string `json:"parentPath,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` -} - -// MarshalJSON is the custom marshaler for SubvolumeProperties. -func (sp SubvolumeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if sp.Path != nil { - objectMap["path"] = sp.Path - } - if sp.Size != nil { - objectMap["size"] = sp.Size - } - if sp.ParentPath != nil { - objectMap["parentPath"] = sp.ParentPath - } - return json.Marshal(objectMap) -} - -// SubvolumesCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (SubvolumeInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesCreateFuture.Result. -func (future *SubvolumesCreateFuture) result(client SubvolumesClient) (si SubvolumeInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - si.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if si.Response.Response, err = future.GetResult(sender); err == nil && si.Response.Response.StatusCode != http.StatusNoContent { - si, err = client.CreateResponder(si.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesCreateFuture", "Result", si.Response.Response, "Failure responding to request") - } - } - return -} - -// SubvolumesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesDeleteFuture.Result. -func (future *SubvolumesDeleteFuture) result(client SubvolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// SubvolumesGetMetadataFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesGetMetadataFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (SubvolumeModel, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesGetMetadataFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesGetMetadataFuture.Result. -func (future *SubvolumesGetMetadataFuture) result(client SubvolumesClient) (sm SubvolumeModel, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesGetMetadataFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - sm.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesGetMetadataFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if sm.Response.Response, err = future.GetResult(sender); err == nil && sm.Response.Response.StatusCode != http.StatusNoContent { - sm, err = client.GetMetadataResponder(sm.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesGetMetadataFuture", "Result", sm.Response.Response, "Failure responding to request") - } - } - return -} - -// SubvolumesList list of Subvolumes -type SubvolumesList struct { - autorest.Response `json:"-"` - // Value - A list of Subvolumes - Value *[]SubvolumeInfo `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// SubvolumesListIterator provides access to a complete listing of SubvolumeInfo values. -type SubvolumesListIterator struct { - i int - page SubvolumesListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *SubvolumesListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *SubvolumesListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter SubvolumesListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter SubvolumesListIterator) Response() SubvolumesList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter SubvolumesListIterator) Value() SubvolumeInfo { - if !iter.page.NotDone() { - return SubvolumeInfo{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the SubvolumesListIterator type. -func NewSubvolumesListIterator(page SubvolumesListPage) SubvolumesListIterator { - return SubvolumesListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (sl SubvolumesList) IsEmpty() bool { - return sl.Value == nil || len(*sl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (sl SubvolumesList) hasNextLink() bool { - return sl.NextLink != nil && len(*sl.NextLink) != 0 -} - -// subvolumesListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (sl SubvolumesList) subvolumesListPreparer(ctx context.Context) (*http.Request, error) { - if !sl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(sl.NextLink))) -} - -// SubvolumesListPage contains a page of SubvolumeInfo values. -type SubvolumesListPage struct { - fn func(context.Context, SubvolumesList) (SubvolumesList, error) - sl SubvolumesList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *SubvolumesListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.sl) - if err != nil { - return err - } - page.sl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *SubvolumesListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page SubvolumesListPage) NotDone() bool { - return !page.sl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page SubvolumesListPage) Response() SubvolumesList { - return page.sl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page SubvolumesListPage) Values() []SubvolumeInfo { - if page.sl.IsEmpty() { - return nil - } - return *page.sl.Value -} - -// Creates a new instance of the SubvolumesListPage type. -func NewSubvolumesListPage(cur SubvolumesList, getNextPage func(context.Context, SubvolumesList) (SubvolumesList, error)) SubvolumesListPage { - return SubvolumesListPage{ - fn: getNextPage, - sl: cur, - } -} - -// SubvolumesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type SubvolumesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(SubvolumesClient) (SubvolumeInfo, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *SubvolumesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for SubvolumesUpdateFuture.Result. -func (future *SubvolumesUpdateFuture) result(client SubvolumesClient) (si SubvolumeInfo, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - si.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.SubvolumesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if si.Response.Response, err = future.GetResult(sender); err == nil && si.Response.Response.StatusCode != http.StatusNoContent { - si, err = client.UpdateResponder(si.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesUpdateFuture", "Result", si.Response.Response, "Failure responding to request") - } - } - return -} - -// SystemData metadata pertaining to creation and last modification of the resource. -type SystemData struct { - // CreatedBy - The identity that created the resource. - CreatedBy *string `json:"createdBy,omitempty"` - // CreatedByType - The type of identity that created the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - CreatedByType CreatedByType `json:"createdByType,omitempty"` - // CreatedAt - The timestamp of resource creation (UTC). - CreatedAt *date.Time `json:"createdAt,omitempty"` - // LastModifiedBy - The identity that last modified the resource. - LastModifiedBy *string `json:"lastModifiedBy,omitempty"` - // LastModifiedByType - The type of identity that last modified the resource. Possible values include: 'CreatedByTypeUser', 'CreatedByTypeApplication', 'CreatedByTypeManagedIdentity', 'CreatedByTypeKey' - LastModifiedByType CreatedByType `json:"lastModifiedByType,omitempty"` - // LastModifiedAt - The timestamp of resource last modification (UTC) - LastModifiedAt *date.Time `json:"lastModifiedAt,omitempty"` -} - -// TrackedResource the resource model definition for an Azure Resource Manager tracked top level resource -// which has 'tags' and a 'location' -type TrackedResource struct { - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` - // Location - The geo-location where the resource lives - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; The name of the resource - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string `json:"type,omitempty"` -} - -// MarshalJSON is the custom marshaler for TrackedResource. -func (tr TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if tr.Tags != nil { - objectMap["tags"] = tr.Tags - } - if tr.Location != nil { - objectMap["location"] = tr.Location - } - return json.Marshal(objectMap) -} - -// Vault vault information -type Vault struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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"` - // VaultProperties - Vault Properties - *VaultProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for Vault. -func (vVar Vault) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.VaultProperties != nil { - objectMap["properties"] = vVar.VaultProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Vault struct. -func (vVar *Vault) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - case "properties": - if v != nil { - var vaultProperties VaultProperties - err = json.Unmarshal(*v, &vaultProperties) - if err != nil { - return err - } - vVar.VaultProperties = &vaultProperties - } - } - } - - return nil -} - -// VaultList list of Vaults -type VaultList struct { - autorest.Response `json:"-"` - // Value - A list of vaults - Value *[]Vault `json:"value,omitempty"` -} - -// VaultProperties vault properties -type VaultProperties struct { - // VaultName - Vault Name - VaultName *string `json:"vaultName,omitempty"` -} - -// Volume volume resource -type Volume struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - READ-ONLY; Resource name - Name *string `json:"name,omitempty"` - // Etag - READ-ONLY; A unique read-only string that changes whenever the resource is updated. - Etag *string `json:"etag,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumeProperties - Volume properties - *VolumeProperties `json:"properties,omitempty"` - // SystemData - READ-ONLY; The system meta data relating to this resource. - SystemData *SystemData `json:"systemData,omitempty"` -} - -// MarshalJSON is the custom marshaler for Volume. -func (vVar Volume) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vVar.Location != nil { - objectMap["location"] = vVar.Location - } - if vVar.Tags != nil { - objectMap["tags"] = vVar.Tags - } - if vVar.VolumeProperties != nil { - objectMap["properties"] = vVar.VolumeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for Volume struct. -func (vVar *Volume) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vVar.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vVar.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vVar.Name = &name - } - case "etag": - if v != nil { - var etag string - err = json.Unmarshal(*v, &etag) - if err != nil { - return err - } - vVar.Etag = &etag - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vVar.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vVar.Tags = tags - } - case "properties": - if v != nil { - var volumeProperties VolumeProperties - err = json.Unmarshal(*v, &volumeProperties) - if err != nil { - return err - } - vVar.VolumeProperties = &volumeProperties - } - case "systemData": - if v != nil { - var systemData SystemData - err = json.Unmarshal(*v, &systemData) - if err != nil { - return err - } - vVar.SystemData = &systemData - } - } - } - - return nil -} - -// VolumeBackupProperties volume Backup Properties -type VolumeBackupProperties struct { - // BackupPolicyID - Backup Policy Resource ID - BackupPolicyID *string `json:"backupPolicyId,omitempty"` - // PolicyEnforced - Policy Enforced - PolicyEnforced *bool `json:"policyEnforced,omitempty"` - // VaultID - Vault Resource ID - VaultID *string `json:"vaultId,omitempty"` - // BackupEnabled - Backup Enabled - BackupEnabled *bool `json:"backupEnabled,omitempty"` -} - -// VolumeBackups volume details using the backup policy -type VolumeBackups struct { - // VolumeName - Volume name - VolumeName *string `json:"volumeName,omitempty"` - // BackupsCount - Total count of backups for volume - BackupsCount *int32 `json:"backupsCount,omitempty"` - // PolicyEnabled - Policy enabled - PolicyEnabled *bool `json:"policyEnabled,omitempty"` -} - -// VolumeGroup volume group resource -type VolumeGroup struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // VolumeGroupListProperties - Volume group properties - *VolumeGroupListProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroup. -func (vg VolumeGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vg.Location != nil { - objectMap["location"] = vg.Location - } - if vg.Tags != nil { - objectMap["tags"] = vg.Tags - } - if vg.VolumeGroupListProperties != nil { - objectMap["properties"] = vg.VolumeGroupListProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeGroup struct. -func (vg *VolumeGroup) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vg.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vg.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vg.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vg.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vg.Tags = tags - } - case "properties": - if v != nil { - var volumeGroupListProperties VolumeGroupListProperties - err = json.Unmarshal(*v, &volumeGroupListProperties) - if err != nil { - return err - } - vg.VolumeGroupListProperties = &volumeGroupListProperties - } - } - } - - return nil -} - -// VolumeGroupDetails volume group resource for create -type VolumeGroupDetails struct { - autorest.Response `json:"-"` - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // VolumeGroupProperties - Volume group properties - *VolumeGroupProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupDetails. -func (vgd VolumeGroupDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgd.Location != nil { - objectMap["location"] = vgd.Location - } - if vgd.Tags != nil { - objectMap["tags"] = vgd.Tags - } - if vgd.VolumeGroupProperties != nil { - objectMap["properties"] = vgd.VolumeGroupProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeGroupDetails struct. -func (vgd *VolumeGroupDetails) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vgd.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vgd.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vgd.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vgd.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vgd.Tags = tags - } - case "properties": - if v != nil { - var volumeGroupProperties VolumeGroupProperties - err = json.Unmarshal(*v, &volumeGroupProperties) - if err != nil { - return err - } - vgd.VolumeGroupProperties = &volumeGroupProperties - } - } - } - - return nil -} - -// VolumeGroupList list of volume group resources -type VolumeGroupList struct { - autorest.Response `json:"-"` - // Value - List of volume Groups - Value *[]VolumeGroup `json:"value,omitempty"` -} - -// VolumeGroupListProperties volume group properties -type VolumeGroupListProperties struct { - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // GroupMetaData - Volume group details - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupListProperties. -func (vglp VolumeGroupListProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vglp.GroupMetaData != nil { - objectMap["groupMetaData"] = vglp.GroupMetaData - } - return json.Marshal(objectMap) -} - -// VolumeGroupMetaData volume group properties -type VolumeGroupMetaData struct { - // GroupDescription - Group Description - GroupDescription *string `json:"groupDescription,omitempty"` - // ApplicationType - Application Type. Possible values include: 'ApplicationTypeSAPHANA' - ApplicationType ApplicationType `json:"applicationType,omitempty"` - // ApplicationIdentifier - Application specific identifier - ApplicationIdentifier *string `json:"applicationIdentifier,omitempty"` - // GlobalPlacementRules - Application specific placement rules for the volume group - GlobalPlacementRules *[]PlacementKeyValuePairs `json:"globalPlacementRules,omitempty"` - // DeploymentSpecID - Application specific identifier of deployment rules for the volume group - DeploymentSpecID *string `json:"deploymentSpecId,omitempty"` - // VolumesCount - READ-ONLY; Number of volumes in volume group - VolumesCount *int64 `json:"volumesCount,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupMetaData. -func (vgmd VolumeGroupMetaData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgmd.GroupDescription != nil { - objectMap["groupDescription"] = vgmd.GroupDescription - } - if vgmd.ApplicationType != "" { - objectMap["applicationType"] = vgmd.ApplicationType - } - if vgmd.ApplicationIdentifier != nil { - objectMap["applicationIdentifier"] = vgmd.ApplicationIdentifier - } - if vgmd.GlobalPlacementRules != nil { - objectMap["globalPlacementRules"] = vgmd.GlobalPlacementRules - } - if vgmd.DeploymentSpecID != nil { - objectMap["deploymentSpecId"] = vgmd.DeploymentSpecID - } - return json.Marshal(objectMap) -} - -// VolumeGroupProperties volume group properties -type VolumeGroupProperties struct { - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // GroupMetaData - Volume group details - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - // Volumes - List of volumes from group - Volumes *[]VolumeGroupVolumeProperties `json:"volumes,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupProperties. -func (vgp VolumeGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgp.GroupMetaData != nil { - objectMap["groupMetaData"] = vgp.GroupMetaData - } - if vgp.Volumes != nil { - objectMap["volumes"] = vgp.Volumes - } - return json.Marshal(objectMap) -} - -// VolumeGroupsCreateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumeGroupsCreateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumeGroupsClient) (VolumeGroupDetails, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumeGroupsCreateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumeGroupsCreateFuture.Result. -func (future *VolumeGroupsCreateFuture) result(client VolumeGroupsClient) (vgd VolumeGroupDetails, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsCreateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vgd.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumeGroupsCreateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vgd.Response.Response, err = future.GetResult(sender); err == nil && vgd.Response.Response.StatusCode != http.StatusNoContent { - vgd, err = client.CreateResponder(vgd.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsCreateFuture", "Result", vgd.Response.Response, "Failure responding to request") - } - } - return -} - -// VolumeGroupsDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumeGroupsDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumeGroupsClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumeGroupsDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumeGroupsDeleteFuture.Result. -func (future *VolumeGroupsDeleteFuture) result(client VolumeGroupsClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumeGroupsDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumeGroupVolumeProperties volume resource -type VolumeGroupVolumeProperties struct { - // ID - READ-ONLY; Resource Id - ID *string `json:"id,omitempty"` - // Name - Resource name - Name *string `json:"name,omitempty"` - // Type - READ-ONLY; Resource type - Type *string `json:"type,omitempty"` - // Tags - Resource tags - Tags map[string]*string `json:"tags"` - // VolumeProperties - Volume properties - *VolumeProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeGroupVolumeProperties. -func (vgvp VolumeGroupVolumeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vgvp.Name != nil { - objectMap["name"] = vgvp.Name - } - if vgvp.Tags != nil { - objectMap["tags"] = vgvp.Tags - } - if vgvp.VolumeProperties != nil { - objectMap["properties"] = vgvp.VolumeProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumeGroupVolumeProperties struct. -func (vgvp *VolumeGroupVolumeProperties) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vgvp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vgvp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vgvp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vgvp.Tags = tags - } - case "properties": - if v != nil { - var volumeProperties VolumeProperties - err = json.Unmarshal(*v, &volumeProperties) - if err != nil { - return err - } - vgvp.VolumeProperties = &volumeProperties - } - } - } - - return nil -} - -// VolumeList list of volume resources -type VolumeList struct { - autorest.Response `json:"-"` - // Value - List of volumes - Value *[]Volume `json:"value,omitempty"` - // NextLink - URL to get the next set of results. - NextLink *string `json:"nextLink,omitempty"` -} - -// VolumeListIterator provides access to a complete listing of Volume values. -type VolumeListIterator struct { - i int - page VolumeListPage -} - -// NextWithContext advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -func (iter *VolumeListIterator) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListIterator.NextWithContext") - defer func() { - sc := -1 - if iter.Response().Response.Response != nil { - sc = iter.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - iter.i++ - if iter.i < len(iter.page.Values()) { - return nil - } - err = iter.page.NextWithContext(ctx) - if err != nil { - iter.i-- - return err - } - iter.i = 0 - return nil -} - -// Next advances to the next value. If there was an error making -// the request the iterator does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (iter *VolumeListIterator) Next() error { - return iter.NextWithContext(context.Background()) -} - -// NotDone returns true if the enumeration should be started or is not yet complete. -func (iter VolumeListIterator) NotDone() bool { - return iter.page.NotDone() && iter.i < len(iter.page.Values()) -} - -// Response returns the raw server response from the last page request. -func (iter VolumeListIterator) Response() VolumeList { - return iter.page.Response() -} - -// Value returns the current value or a zero-initialized value if the -// iterator has advanced beyond the end of the collection. -func (iter VolumeListIterator) Value() Volume { - if !iter.page.NotDone() { - return Volume{} - } - return iter.page.Values()[iter.i] -} - -// Creates a new instance of the VolumeListIterator type. -func NewVolumeListIterator(page VolumeListPage) VolumeListIterator { - return VolumeListIterator{page: page} -} - -// IsEmpty returns true if the ListResult contains no values. -func (vl VolumeList) IsEmpty() bool { - return vl.Value == nil || len(*vl.Value) == 0 -} - -// hasNextLink returns true if the NextLink is not empty. -func (vl VolumeList) hasNextLink() bool { - return vl.NextLink != nil && len(*vl.NextLink) != 0 -} - -// volumeListPreparer prepares a request to retrieve the next set of results. -// It returns nil if no more results exist. -func (vl VolumeList) volumeListPreparer(ctx context.Context) (*http.Request, error) { - if !vl.hasNextLink() { - return nil, nil - } - return autorest.Prepare((&http.Request{}).WithContext(ctx), - autorest.AsJSON(), - autorest.AsGet(), - autorest.WithBaseURL(to.String(vl.NextLink))) -} - -// VolumeListPage contains a page of Volume values. -type VolumeListPage struct { - fn func(context.Context, VolumeList) (VolumeList, error) - vl VolumeList -} - -// NextWithContext advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -func (page *VolumeListPage) NextWithContext(ctx context.Context) (err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeListPage.NextWithContext") - defer func() { - sc := -1 - if page.Response().Response.Response != nil { - sc = page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - for { - next, err := page.fn(ctx, page.vl) - if err != nil { - return err - } - page.vl = next - if !next.hasNextLink() || !next.IsEmpty() { - break - } - } - return nil -} - -// Next advances to the next page of values. If there was an error making -// the request the page does not advance and the error is returned. -// Deprecated: Use NextWithContext() instead. -func (page *VolumeListPage) Next() error { - return page.NextWithContext(context.Background()) -} - -// NotDone returns true if the page enumeration should be started or is not yet complete. -func (page VolumeListPage) NotDone() bool { - return !page.vl.IsEmpty() -} - -// Response returns the raw server response from the last page request. -func (page VolumeListPage) Response() VolumeList { - return page.vl -} - -// Values returns the slice of values for the current page or nil if there are no values. -func (page VolumeListPage) Values() []Volume { - if page.vl.IsEmpty() { - return nil - } - return *page.vl.Value -} - -// Creates a new instance of the VolumeListPage type. -func NewVolumeListPage(cur VolumeList, getNextPage func(context.Context, VolumeList) (VolumeList, error)) VolumeListPage { - return VolumeListPage{ - fn: getNextPage, - vl: cur, - } -} - -// VolumePatch volume patch resource -type VolumePatch struct { - // Location - Resource location - Location *string `json:"location,omitempty"` - // ID - READ-ONLY; Resource Id - 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 map[string]*string `json:"tags"` - // VolumePatchProperties - Patchable volume properties - *VolumePatchProperties `json:"properties,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumePatch. -func (vp VolumePatch) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.Location != nil { - objectMap["location"] = vp.Location - } - if vp.Tags != nil { - objectMap["tags"] = vp.Tags - } - if vp.VolumePatchProperties != nil { - objectMap["properties"] = vp.VolumePatchProperties - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON is the custom unmarshaler for VolumePatch struct. -func (vp *VolumePatch) UnmarshalJSON(body []byte) error { - var m map[string]*json.RawMessage - err := json.Unmarshal(body, &m) - if err != nil { - return err - } - for k, v := range m { - switch k { - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - vp.Location = &location - } - case "id": - if v != nil { - var ID string - err = json.Unmarshal(*v, &ID) - if err != nil { - return err - } - vp.ID = &ID - } - case "name": - if v != nil { - var name string - err = json.Unmarshal(*v, &name) - if err != nil { - return err - } - vp.Name = &name - } - case "type": - if v != nil { - var typeVar string - err = json.Unmarshal(*v, &typeVar) - if err != nil { - return err - } - vp.Type = &typeVar - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - vp.Tags = tags - } - case "properties": - if v != nil { - var volumePatchProperties VolumePatchProperties - err = json.Unmarshal(*v, &volumePatchProperties) - if err != nil { - return err - } - vp.VolumePatchProperties = &volumePatchProperties - } - } - } - - return nil -} - -// VolumePatchProperties patchable volume properties -type VolumePatchProperties struct { - // ServiceLevel - Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra', 'ServiceLevelStandardZRS' - ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` - // UsageThreshold - Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. - UsageThreshold *int64 `json:"usageThreshold,omitempty"` - // ExportPolicy - Set of export policy rules - ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - // DataProtection - DataProtection type volumes include an object containing details of the replication - DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` - // IsDefaultQuotaEnabled - Specifies if default quota is enabled for the volume. - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - // DefaultUserQuotaInKiBs - Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - // DefaultGroupQuotaInKiBs - Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - // UnixPermissions - UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - UnixPermissions *string `json:"unixPermissions,omitempty"` -} - -// VolumePatchPropertiesDataProtection dataProtection type volumes include an object containing details of -// the replication -type VolumePatchPropertiesDataProtection struct { - // Backup - Backup Properties - Backup *VolumeBackupProperties `json:"backup,omitempty"` - // Snapshot - Snapshot properties. - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} - -// VolumePatchPropertiesExportPolicy set of export policy rules -type VolumePatchPropertiesExportPolicy struct { - // Rules - Export policy rule - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} - -// VolumeProperties volume properties -type VolumeProperties struct { - // FileSystemID - READ-ONLY; Unique FileSystem Identifier. - FileSystemID *string `json:"fileSystemId,omitempty"` - // CreationToken - A unique file path for the volume. Used when creating mount targets - CreationToken *string `json:"creationToken,omitempty"` - // ServiceLevel - Possible values include: 'ServiceLevelStandard', 'ServiceLevelPremium', 'ServiceLevelUltra', 'ServiceLevelStandardZRS' - ServiceLevel ServiceLevel `json:"serviceLevel,omitempty"` - // UsageThreshold - Maximum storage quota allowed for a file system in bytes. This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. - UsageThreshold *int64 `json:"usageThreshold,omitempty"` - // ExportPolicy - Set of export policy rules - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - // ProtocolTypes - Set of protocol types, default NFSv3, CIFS for SMB protocol - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - // ProvisioningState - READ-ONLY; Azure lifecycle management - ProvisioningState *string `json:"provisioningState,omitempty"` - // SnapshotID - UUID v4 or resource identifier used to identify the Snapshot. - SnapshotID *string `json:"snapshotId,omitempty"` - // BackupID - UUID v4 or resource identifier used to identify the Backup. - BackupID *string `json:"backupId,omitempty"` - // BaremetalTenantID - READ-ONLY; Unique Baremetal Tenant Identifier. - BaremetalTenantID *string `json:"baremetalTenantId,omitempty"` - // SubnetID - The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes - SubnetID *string `json:"subnetId,omitempty"` - // NetworkFeatures - Basic network, or Standard features available to the volume. Possible values include: 'NetworkFeaturesBasic', 'NetworkFeaturesStandard' - NetworkFeatures NetworkFeatures `json:"networkFeatures,omitempty"` - // NetworkSiblingSetID - READ-ONLY; Network Sibling Set ID for the the group of volumes sharing networking resources. - NetworkSiblingSetID *string `json:"networkSiblingSetId,omitempty"` - // StorageToNetworkProximity - READ-ONLY; Provides storage to network proximity information for the volume. Possible values include: 'VolumeStorageToNetworkProximityDefault', 'VolumeStorageToNetworkProximityT1', 'VolumeStorageToNetworkProximityT2' - StorageToNetworkProximity VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - // MountTargets - READ-ONLY; List of mount targets - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - // VolumeType - What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection - 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"` - // SnapshotDirectoryVisible - If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (default to true). - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - // KerberosEnabled - Describe if a volume is KerberosEnabled. To be use with swagger version 2020-05-01 or later - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - // SecurityStyle - The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. Possible values include: 'SecurityStyleNtfs', 'SecurityStyleUnix' - SecurityStyle SecurityStyle `json:"securityStyle,omitempty"` - // SmbEncryption - Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later - SmbEncryption *bool `json:"smbEncryption,omitempty"` - // SmbContinuouslyAvailable - Enables continuously available share property for smb volume. Only applicable for SMB volume - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - // EncryptionKeySource - Encryption Key Source. Possible values are: 'Microsoft.NetApp' - EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` - // LdapEnabled - Specifies whether LDAP is enabled or not for a given NFS volume. - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - // CoolAccess - Specifies whether Cool Access(tiering) is enabled for the volume. - CoolAccess *bool `json:"coolAccess,omitempty"` - // CoolnessPeriod - Specifies the number of days after which data that is not accessed by clients will be tiered. - CoolnessPeriod *int32 `json:"coolnessPeriod,omitempty"` - // UnixPermissions - UNIX permissions for NFS volume accepted in octal 4 digit format. First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - UnixPermissions *string `json:"unixPermissions,omitempty"` - // CloneProgress - READ-ONLY; When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. - CloneProgress *int32 `json:"cloneProgress,omitempty"` - // AvsDataStore - Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. Possible values include: 'AvsDataStoreEnabled', 'AvsDataStoreDisabled' - AvsDataStore AvsDataStore `json:"avsDataStore,omitempty"` - // IsDefaultQuotaEnabled - Specifies if default quota is enabled for the volume. - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - // DefaultUserQuotaInKiBs - Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - // DefaultGroupQuotaInKiBs - Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - // MaximumNumberOfFiles - READ-ONLY; Maximum number of files allowed. Needs a service request in order to be changed. Only allowed to be changed if volume quota is more than 4TiB. - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - // VolumeGroupName - READ-ONLY; Volume Group Name - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - // CapacityPoolResourceID - Pool Resource Id used in case of creating a volume through volume group - CapacityPoolResourceID *string `json:"capacityPoolResourceId,omitempty"` - // ProximityPlacementGroup - Proximity placement group associated with the volume - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - // T2Network - READ-ONLY; T2 network information - T2Network *string `json:"t2Network,omitempty"` - // VolumeSpecName - Volume spec name is the application specific designation or identifier for the particular volume in a volume group for e.g. data, log - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - // PlacementRules - Application specific placement rules for the particular volume - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - // EnableSubvolumes - Flag indicating whether subvolume operations are enabled on the volume. Possible values include: 'EnableSubvolumesEnabled', 'EnableSubvolumesDisabled' - EnableSubvolumes EnableSubvolumes `json:"enableSubvolumes,omitempty"` -} - -// MarshalJSON is the custom marshaler for VolumeProperties. -func (vp VolumeProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if vp.CreationToken != nil { - objectMap["creationToken"] = vp.CreationToken - } - if vp.ServiceLevel != "" { - objectMap["serviceLevel"] = vp.ServiceLevel - } - if vp.UsageThreshold != nil { - objectMap["usageThreshold"] = vp.UsageThreshold - } - if vp.ExportPolicy != nil { - objectMap["exportPolicy"] = vp.ExportPolicy - } - if vp.ProtocolTypes != nil { - objectMap["protocolTypes"] = vp.ProtocolTypes - } - if vp.SnapshotID != nil { - objectMap["snapshotId"] = vp.SnapshotID - } - if vp.BackupID != nil { - objectMap["backupId"] = vp.BackupID - } - if vp.SubnetID != nil { - objectMap["subnetId"] = vp.SubnetID - } - if vp.NetworkFeatures != "" { - objectMap["networkFeatures"] = vp.NetworkFeatures - } - if vp.VolumeType != nil { - objectMap["volumeType"] = vp.VolumeType - } - if vp.DataProtection != nil { - objectMap["dataProtection"] = vp.DataProtection - } - if vp.IsRestoring != nil { - objectMap["isRestoring"] = vp.IsRestoring - } - if vp.SnapshotDirectoryVisible != nil { - objectMap["snapshotDirectoryVisible"] = vp.SnapshotDirectoryVisible - } - if vp.KerberosEnabled != nil { - objectMap["kerberosEnabled"] = vp.KerberosEnabled - } - if vp.SecurityStyle != "" { - objectMap["securityStyle"] = vp.SecurityStyle - } - if vp.SmbEncryption != nil { - objectMap["smbEncryption"] = vp.SmbEncryption - } - if vp.SmbContinuouslyAvailable != nil { - objectMap["smbContinuouslyAvailable"] = vp.SmbContinuouslyAvailable - } - if vp.ThroughputMibps != nil { - objectMap["throughputMibps"] = vp.ThroughputMibps - } - if vp.EncryptionKeySource != nil { - objectMap["encryptionKeySource"] = vp.EncryptionKeySource - } - if vp.LdapEnabled != nil { - objectMap["ldapEnabled"] = vp.LdapEnabled - } - if vp.CoolAccess != nil { - objectMap["coolAccess"] = vp.CoolAccess - } - if vp.CoolnessPeriod != nil { - objectMap["coolnessPeriod"] = vp.CoolnessPeriod - } - if vp.UnixPermissions != nil { - objectMap["unixPermissions"] = vp.UnixPermissions - } - if vp.AvsDataStore != "" { - objectMap["avsDataStore"] = vp.AvsDataStore - } - if vp.IsDefaultQuotaEnabled != nil { - objectMap["isDefaultQuotaEnabled"] = vp.IsDefaultQuotaEnabled - } - if vp.DefaultUserQuotaInKiBs != nil { - objectMap["defaultUserQuotaInKiBs"] = vp.DefaultUserQuotaInKiBs - } - if vp.DefaultGroupQuotaInKiBs != nil { - objectMap["defaultGroupQuotaInKiBs"] = vp.DefaultGroupQuotaInKiBs - } - if vp.CapacityPoolResourceID != nil { - objectMap["capacityPoolResourceId"] = vp.CapacityPoolResourceID - } - if vp.ProximityPlacementGroup != nil { - objectMap["proximityPlacementGroup"] = vp.ProximityPlacementGroup - } - if vp.VolumeSpecName != nil { - objectMap["volumeSpecName"] = vp.VolumeSpecName - } - if vp.PlacementRules != nil { - objectMap["placementRules"] = vp.PlacementRules - } - if vp.EnableSubvolumes != "" { - objectMap["enableSubvolumes"] = vp.EnableSubvolumes - } - return json.Marshal(objectMap) -} - -// VolumePropertiesDataProtection dataProtection type volumes include an object containing details of the -// replication -type VolumePropertiesDataProtection struct { - // Backup - Backup Properties - Backup *VolumeBackupProperties `json:"backup,omitempty"` - // Replication - Replication properties - Replication *ReplicationObject `json:"replication,omitempty"` - // Snapshot - Snapshot properties. - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} - -// VolumePropertiesExportPolicy set of export policy rules -type VolumePropertiesExportPolicy struct { - // Rules - Export policy rule - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} - -// VolumeRevert revert a volume to the snapshot -type VolumeRevert struct { - // SnapshotID - Resource id of the snapshot - SnapshotID *string `json:"snapshotId,omitempty"` -} - -// VolumesAuthorizeReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesAuthorizeReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesAuthorizeReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesAuthorizeReplicationFuture.Result. -func (future *VolumesAuthorizeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesAuthorizeReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesAuthorizeReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesBreakReplicationFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesBreakReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesBreakReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesBreakReplicationFuture.Result. -func (future *VolumesBreakReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesBreakReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesBreakReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesCreateOrUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesCreateOrUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (Volume, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesCreateOrUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesCreateOrUpdateFuture.Result. -func (future *VolumesCreateOrUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesCreateOrUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.CreateOrUpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesCreateOrUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// VolumesDeleteFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesDeleteFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesDeleteFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesDeleteFuture.Result. -func (future *VolumesDeleteFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesDeleteReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesDeleteReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesDeleteReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesDeleteReplicationFuture.Result. -func (future *VolumesDeleteReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesDeleteReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesDeleteReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumeSnapshotProperties volume Snapshot Properties -type VolumeSnapshotProperties struct { - // SnapshotPolicyID - Snapshot Policy ResourceId - SnapshotPolicyID *string `json:"snapshotPolicyId,omitempty"` -} - -// VolumesPoolChangeFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesPoolChangeFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesPoolChangeFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesPoolChangeFuture.Result. -func (future *VolumesPoolChangeFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesPoolChangeFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesPoolChangeFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesReInitializeReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesReInitializeReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesReInitializeReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesReInitializeReplicationFuture.Result. -func (future *VolumesReInitializeReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesReInitializeReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesReInitializeReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesResyncReplicationFuture an abstraction for monitoring and retrieving the results of a -// long-running operation. -type VolumesResyncReplicationFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesResyncReplicationFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesResyncReplicationFuture.Result. -func (future *VolumesResyncReplicationFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesResyncReplicationFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesResyncReplicationFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesRevertFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesRevertFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (autorest.Response, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesRevertFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesRevertFuture.Result. -func (future *VolumesRevertFuture) result(client VolumesClient) (ar autorest.Response, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesRevertFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - ar.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesRevertFuture") - return - } - ar.Response = future.Response() - return -} - -// VolumesUpdateFuture an abstraction for monitoring and retrieving the results of a long-running -// operation. -type VolumesUpdateFuture struct { - azure.FutureAPI - // Result returns the result of the asynchronous operation. - // If the operation has not completed it will return an error. - Result func(VolumesClient) (Volume, error) -} - -// UnmarshalJSON is the custom unmarshaller for CreateFuture. -func (future *VolumesUpdateFuture) UnmarshalJSON(body []byte) error { - var azFuture azure.Future - if err := json.Unmarshal(body, &azFuture); err != nil { - return err - } - future.FutureAPI = &azFuture - future.Result = future.result - return nil -} - -// result is the default implementation for VolumesUpdateFuture.Result. -func (future *VolumesUpdateFuture) result(client VolumesClient) (vVar Volume, err error) { - var done bool - done, err = future.DoneWithContext(context.Background(), client) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", future.Response(), "Polling failure") - return - } - if !done { - vVar.Response.Response = future.Response() - err = azure.NewAsyncOpIncompleteError("netapp.VolumesUpdateFuture") - return - } - sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) - if vVar.Response.Response, err = future.GetResult(sender); err == nil && vVar.Response.Response.StatusCode != http.StatusNoContent { - vVar, err = client.UpdateResponder(vVar.Response.Response) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesUpdateFuture", "Result", vVar.Response.Response, "Failure responding to request") - } - } - return -} - -// WeeklySchedule weekly Schedule properties, make a snapshot every week at a specific day or days -type WeeklySchedule struct { - // SnapshotsToKeep - Weekly snapshot count to keep - SnapshotsToKeep *int32 `json:"snapshotsToKeep,omitempty"` - // Day - Indicates which weekdays snapshot should be taken, accepts a comma separated list of week day names in english - Day *string `json:"day,omitempty"` - // Hour - Indicates which hour in UTC timezone a snapshot should be taken - Hour *int32 `json:"hour,omitempty"` - // Minute - Indicates which minute snapshot should be taken - Minute *int32 `json:"minute,omitempty"` - // UsedBytes - Resource size in bytes, current storage usage for the volume in bytes - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/operations.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/operations.go deleted file mode 100644 index d903fa2473a3..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/operations.go +++ /dev/null @@ -1,98 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// OperationsClient is the microsoft NetApp Files Azure Resource Provider specification -type OperationsClient struct { - BaseClient -} - -// NewOperationsClient creates an instance of the OperationsClient client. -func NewOperationsClient(subscriptionID string) OperationsClient { - return NewOperationsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewOperationsClientWithBaseURI creates an instance of the OperationsClient 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 NewOperationsClientWithBaseURI(baseURI string, subscriptionID string) OperationsClient { - return OperationsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List lists all of the available Microsoft.NetApp Rest API operations -func (client OperationsClient) List(ctx context.Context) (result OperationListResult, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/OperationsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.OperationsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client OperationsClient) ListPreparer(ctx context.Context) (*http.Request, error) { - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPath("/providers/Microsoft.NetApp/operations"), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client OperationsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client OperationsClient) ListResponder(resp *http.Response) (result OperationListResult, 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/netapp/mgmt/2021-10-01/netapp/pools.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/pools.go deleted file mode 100644 index 67284b542dfa..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/pools.go +++ /dev/null @@ -1,550 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// PoolsClient is the microsoft NetApp Files Azure Resource Provider specification -type PoolsClient struct { - BaseClient -} - -// NewPoolsClient creates an instance of the PoolsClient client. -func NewPoolsClient(subscriptionID string) PoolsClient { - return NewPoolsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewPoolsClientWithBaseURI creates an instance of the PoolsClient 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 NewPoolsClientWithBaseURI(baseURI string, subscriptionID string) PoolsClient { - return PoolsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// CreateOrUpdate create or Update a capacity pool -// Parameters: -// body - capacity pool object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) CreateOrUpdate(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName string) (result PoolsCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.PoolProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.PoolProperties.PoolID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.PoolProperties.PoolID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.PoolProperties.PoolID", 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.PoolProperties.Size", Name: validation.Null, Rule: true, Chain: nil}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client PoolsClient) CreateOrUpdatePreparer(ctx context.Context, body CapacityPool, resourceGroupName string, accountName string, poolName 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), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) CreateOrUpdateSender(req *http.Request) (future PoolsCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client PoolsClient) CreateOrUpdateResponder(resp *http.Response) (result CapacityPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified capacity pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result PoolsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client PoolsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName 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), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) DeleteSender(req *http.Request) (future PoolsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client PoolsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of the specified capacity pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result CapacityPool, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client PoolsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName 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), - } - - const APIVersion = "2021-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}", 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 PoolsClient) 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 PoolsClient) GetResponder(resp *http.Response) (result CapacityPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all capacity pools in the NetApp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client PoolsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") - defer func() { - sc := -1 - if result.cpl.Response.Response != nil { - sc = result.cpl.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.PoolsClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.cpl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure sending request") - return - } - - result.cpl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "List", resp, "Failure responding to request") - return - } - if result.cpl.hasNextLink() && result.cpl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client PoolsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client PoolsClient) ListResponder(resp *http.Response) (result CapacityPoolList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client PoolsClient) listNextResults(ctx context.Context, lastResults CapacityPoolList) (result CapacityPoolList, err error) { - req, err := lastResults.capacityPoolListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client PoolsClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string) (result CapacityPoolListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName) - return -} - -// Update patch the specified capacity pool -// Parameters: -// body - capacity pool object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client PoolsClient) Update(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName string) (result PoolsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/PoolsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.PoolsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.PoolsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client PoolsClient) UpdatePreparer(ctx context.Context, body CapacityPoolPatch, resourceGroupName string, accountName string, poolName 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), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client PoolsClient) UpdateSender(req *http.Request) (future PoolsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client PoolsClient) UpdateResponder(resp *http.Response) (result CapacityPool, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resource.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resource.go deleted file mode 100644 index c2e42cc2ad2b..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resource.go +++ /dev/null @@ -1,284 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ResourceClient is the microsoft NetApp Files Azure Resource Provider specification -type ResourceClient struct { - BaseClient -} - -// NewResourceClient creates an instance of the ResourceClient client. -func NewResourceClient(subscriptionID string) ResourceClient { - return NewResourceClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceClientWithBaseURI creates an instance of the ResourceClient 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 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 ResourceClient) CheckFilePathAvailability(ctx context.Context, body FilePathAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckFilePathAvailability") - 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: body, - Constraints: []validation.Constraint{{Target: "body.Name", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.SubnetID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.ResourceClient", "CheckFilePathAvailability", err.Error()) - } - - req, err := client.CheckFilePathAvailabilityPreparer(ctx, body, location) - if err != nil { - 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.ResourceClient", "CheckFilePathAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckFilePathAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckFilePathAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckFilePathAvailabilityPreparer prepares the CheckFilePathAvailability request. -func (client ResourceClient) CheckFilePathAvailabilityPreparer(ctx context.Context, body FilePathAvailabilityRequest, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckFilePathAvailabilitySender sends the CheckFilePathAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckFilePathAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckFilePathAvailabilityResponder handles the response to the CheckFilePathAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckFilePathAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckNameAvailability check if a resource name is available. -// Parameters: -// body - name availability request. -// location - the location -func (client ResourceClient) CheckNameAvailability(ctx context.Context, body ResourceNameAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckNameAvailability") - 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: 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.ResourceClient", "CheckNameAvailability", err.Error()) - } - - req, err := client.CheckNameAvailabilityPreparer(ctx, body, location) - if err != nil { - 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.ResourceClient", "CheckNameAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckNameAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckNameAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckNameAvailabilityPreparer prepares the CheckNameAvailability request. -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 = "2021-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}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckNameAvailabilitySender sends the CheckNameAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckNameAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckNameAvailabilityResponder handles the response to the CheckNameAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckNameAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// CheckQuotaAvailability check if a quota is available. -// Parameters: -// body - quota availability request. -// location - the location -func (client ResourceClient) CheckQuotaAvailability(ctx context.Context, body QuotaAvailabilityRequest, location string) (result CheckAvailabilityResponse, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceClient.CheckQuotaAvailability") - 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: 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.ResourceClient", "CheckQuotaAvailability", err.Error()) - } - - req, err := client.CheckQuotaAvailabilityPreparer(ctx, body, location) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", nil, "Failure preparing request") - return - } - - resp, err := client.CheckQuotaAvailabilitySender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure sending request") - return - } - - result, err = client.CheckQuotaAvailabilityResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceClient", "CheckQuotaAvailability", resp, "Failure responding to request") - return - } - - return -} - -// CheckQuotaAvailabilityPreparer prepares the CheckQuotaAvailability request. -func (client ResourceClient) CheckQuotaAvailabilityPreparer(ctx context.Context, body QuotaAvailabilityRequest, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CheckQuotaAvailabilitySender sends the CheckQuotaAvailability request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceClient) CheckQuotaAvailabilitySender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CheckQuotaAvailabilityResponder handles the response to the CheckQuotaAvailability request. The method always -// closes the http.Response Body. -func (client ResourceClient) CheckQuotaAvailabilityResponder(resp *http.Response) (result CheckAvailabilityResponse, 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/netapp/mgmt/2021-10-01/netapp/resourcequotalimits.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resourcequotalimits.go deleted file mode 100644 index 0cd8f587e0b8..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/resourcequotalimits.go +++ /dev/null @@ -1,182 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// ResourceQuotaLimitsClient is the microsoft NetApp Files Azure Resource Provider specification -type ResourceQuotaLimitsClient struct { - BaseClient -} - -// NewResourceQuotaLimitsClient creates an instance of the ResourceQuotaLimitsClient client. -func NewResourceQuotaLimitsClient(subscriptionID string) ResourceQuotaLimitsClient { - return NewResourceQuotaLimitsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewResourceQuotaLimitsClientWithBaseURI creates an instance of the ResourceQuotaLimitsClient 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 NewResourceQuotaLimitsClientWithBaseURI(baseURI string, subscriptionID string) ResourceQuotaLimitsClient { - return ResourceQuotaLimitsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Get get the default and current subscription quota limit -// Parameters: -// location - the location -// quotaLimitName - the name of the Quota Limit -func (client ResourceQuotaLimitsClient) Get(ctx context.Context, location string, quotaLimitName string) (result SubscriptionQuotaItem, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceQuotaLimitsClient.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, quotaLimitName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client ResourceQuotaLimitsClient) GetPreparer(ctx context.Context, location string, quotaLimitName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "quotaLimitName": autorest.Encode("path", quotaLimitName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}", 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 ResourceQuotaLimitsClient) 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 ResourceQuotaLimitsClient) GetResponder(resp *http.Response) (result SubscriptionQuotaItem, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List get the default and current limits for quotas -// Parameters: -// location - the location -func (client ResourceQuotaLimitsClient) List(ctx context.Context, location string) (result SubscriptionQuotaItemList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/ResourceQuotaLimitsClient.List") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - req, err := client.ListPreparer(ctx, location) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.ResourceQuotaLimitsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client ResourceQuotaLimitsClient) ListPreparer(ctx context.Context, location string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "location": autorest.Encode("path", location), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsGet(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client ResourceQuotaLimitsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client ResourceQuotaLimitsClient) ListResponder(resp *http.Response) (result SubscriptionQuotaItemList, 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/netapp/mgmt/2021-10-01/netapp/snapshotpolicies.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshotpolicies.go deleted file mode 100644 index 365057c6955f..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshotpolicies.go +++ /dev/null @@ -1,569 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SnapshotPoliciesClient is the microsoft NetApp Files Azure Resource Provider specification -type SnapshotPoliciesClient struct { - BaseClient -} - -// NewSnapshotPoliciesClient creates an instance of the SnapshotPoliciesClient client. -func NewSnapshotPoliciesClient(subscriptionID string) SnapshotPoliciesClient { - return NewSnapshotPoliciesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSnapshotPoliciesClientWithBaseURI creates an instance of the SnapshotPoliciesClient 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 NewSnapshotPoliciesClientWithBaseURI(baseURI string, subscriptionID string) SnapshotPoliciesClient { - return SnapshotPoliciesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a snapshot policy -// Parameters: -// body - snapshot policy object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Create(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Create") - 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: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.SnapshotPolicyProperties", Name: validation.Null, Rule: true, Chain: nil}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotPoliciesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", nil, "Failure preparing request") - return - } - - resp, err := client.CreateSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure sending request") - return - } - - result, err = client.CreateResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Create", resp, "Failure responding to request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SnapshotPoliciesClient) CreatePreparer(ctx context.Context, body SnapshotPolicy, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) CreateSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) CreateResponder(resp *http.Response) (result SnapshotPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete snapshot policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.SnapshotPoliciesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SnapshotPoliciesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) DeleteSender(req *http.Request) (future SnapshotPoliciesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get a snapshot Policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Get(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicy, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.SnapshotPoliciesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SnapshotPoliciesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/snapshotPolicies/{snapshotPolicyName}", 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 SnapshotPoliciesClient) 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 SnapshotPoliciesClient) GetResponder(resp *http.Response) (result SnapshotPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list snapshot policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client SnapshotPoliciesClient) List(ctx context.Context, resourceGroupName string, accountName string) (result SnapshotPoliciesList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.List") - 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.SnapshotPoliciesClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SnapshotPoliciesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/snapshotPolicies", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) ListResponder(resp *http.Response) (result SnapshotPoliciesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListVolumes get volumes associated with snapshot policy -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) ListVolumes(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPolicyVolumeList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.ListVolumes") - 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.SnapshotPoliciesClient", "ListVolumes", err.Error()) - } - - req, err := client.ListVolumesPreparer(ctx, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", nil, "Failure preparing request") - return - } - - resp, err := client.ListVolumesSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure sending request") - return - } - - result, err = client.ListVolumesResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "ListVolumes", resp, "Failure responding to request") - return - } - - return -} - -// ListVolumesPreparer prepares the ListVolumes request. -func (client SnapshotPoliciesClient) ListVolumesPreparer(ctx context.Context, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/snapshotPolicies/{snapshotPolicyName}/volumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListVolumesSender sends the ListVolumes request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) ListVolumesSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListVolumesResponder handles the response to the ListVolumes request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) ListVolumesResponder(resp *http.Response) (result SnapshotPolicyVolumeList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Update patch a snapshot policy -// Parameters: -// body - snapshot policy object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// snapshotPolicyName - the name of the snapshot policy -func (client SnapshotPoliciesClient) Update(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (result SnapshotPoliciesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotPoliciesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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.SnapshotPoliciesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, snapshotPolicyName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotPoliciesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SnapshotPoliciesClient) UpdatePreparer(ctx context.Context, body SnapshotPolicyPatch, resourceGroupName string, accountName string, snapshotPolicyName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotPolicyName": autorest.Encode("path", snapshotPolicyName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotPoliciesClient) UpdateSender(req *http.Request) (future SnapshotPoliciesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SnapshotPoliciesClient) UpdateResponder(resp *http.Response) (result SnapshotPolicy, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshots.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshots.go deleted file mode 100644 index d225f05633bc..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/snapshots.go +++ /dev/null @@ -1,654 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SnapshotsClient is the microsoft NetApp Files Azure Resource Provider specification -type SnapshotsClient struct { - BaseClient -} - -// NewSnapshotsClient creates an instance of the SnapshotsClient client. -func NewSnapshotsClient(subscriptionID string) SnapshotsClient { - return NewSnapshotsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSnapshotsClientWithBaseURI creates an instance of the SnapshotsClient 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 NewSnapshotsClientWithBaseURI(baseURI string, subscriptionID string) SnapshotsClient { - return SnapshotsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create the specified snapshot within the given volume -// Parameters: -// body - snapshot object supplied in the body of the operation. -// 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 -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Create(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.SnapshotProperties", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.SnapshotProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.SnapshotProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.SnapshotProperties.SnapshotID", 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}, - }}, - }}}}, - {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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SnapshotsClient) CreatePreparer(ctx context.Context, body Snapshot, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) CreateSender(req *http.Request) (future SnapshotsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) CreateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete snapshot -// 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 -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SnapshotsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) DeleteSender(req *http.Request) (future SnapshotsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of the specified snapshot -// 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 -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result Snapshot, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SnapshotsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-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}/snapshots/{snapshotName}", 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 SnapshotsClient) 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 SnapshotsClient) GetResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all snapshots associated with the 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 SnapshotsClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SnapshotsList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.List") - 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client SnapshotsClient) ListPreparer(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 = "2021-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}/snapshots", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) ListResponder(resp *http.Response) (result SnapshotsList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// RestoreFiles restore the specified files from the specified snapshot to the active filesystem -// Parameters: -// body - restore payload supplied in the body of the operation. -// 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 -// snapshotName - the name of the snapshot -func (client SnapshotsClient) RestoreFiles(ctx context.Context, body SnapshotRestoreFiles, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsRestoreFilesFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.RestoreFiles") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.FilePaths", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.FilePaths", Name: validation.MaxItems, Rule: 10, Chain: nil}, - {Target: "body.FilePaths", Name: validation.MinItems, Rule: 1, Chain: nil}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "RestoreFiles", err.Error()) - } - - req, err := client.RestoreFilesPreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "RestoreFiles", nil, "Failure preparing request") - return - } - - result, err = client.RestoreFilesSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "RestoreFiles", result.Response(), "Failure sending request") - return - } - - return -} - -// RestoreFilesPreparer prepares the RestoreFiles request. -func (client SnapshotsClient) RestoreFilesPreparer(ctx context.Context, body SnapshotRestoreFiles, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-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}/snapshots/{snapshotName}/restoreFiles", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RestoreFilesSender sends the RestoreFiles request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) RestoreFilesSender(req *http.Request) (future SnapshotsRestoreFilesFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RestoreFilesResponder handles the response to the RestoreFiles request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) RestoreFilesResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update patch a snapshot -// Parameters: -// body - snapshot object supplied in the body of the operation. -// 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 -// snapshotName - the name of the snapshot -func (client SnapshotsClient) Update(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (result SnapshotsUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SnapshotsClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SnapshotsClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, snapshotName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SnapshotsClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SnapshotsClient) UpdatePreparer(ctx context.Context, body interface{}, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "poolName": autorest.Encode("path", poolName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "snapshotName": autorest.Encode("path", snapshotName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SnapshotsClient) UpdateSender(req *http.Request) (future SnapshotsUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SnapshotsClient) UpdateResponder(resp *http.Response) (result Snapshot, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/subvolumes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/subvolumes.go deleted file mode 100644 index 54cec7e712e5..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/subvolumes.go +++ /dev/null @@ -1,698 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// SubvolumesClient is the microsoft NetApp Files Azure Resource Provider specification -type SubvolumesClient struct { - BaseClient -} - -// NewSubvolumesClient creates an instance of the SubvolumesClient client. -func NewSubvolumesClient(subscriptionID string) SubvolumesClient { - return NewSubvolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewSubvolumesClientWithBaseURI creates an instance of the SubvolumesClient 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 NewSubvolumesClientWithBaseURI(baseURI string, subscriptionID string) SubvolumesClient { - return SubvolumesClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create creates a subvolume in the path or clones the subvolume mentioned in the parentPath -// Parameters: -// body - subvolume object supplied in the body of the operation. -// 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 -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Create(ctx context.Context, body SubvolumeInfo, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client SubvolumesClient) CreatePreparer(ctx context.Context, body SubvolumeInfo, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName 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), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) CreateSender(req *http.Request) (future SubvolumesCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) CreateResponder(resp *http.Response) (result SubvolumeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete subvolume -// 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 -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client SubvolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName 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), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) DeleteSender(req *http.Request) (future SubvolumesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get returns the path associated with the subvolumeName provided -// 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 -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumeInfo, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client SubvolumesClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName 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), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-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}/subvolumes/{subvolumeName}", 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 SubvolumesClient) 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 SubvolumesClient) GetResponder(resp *http.Response) (result SubvolumeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// GetMetadata get details of the specified subvolume -// 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 -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) GetMetadata(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesGetMetadataFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.GetMetadata") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "GetMetadata", err.Error()) - } - - req, err := client.GetMetadataPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "GetMetadata", nil, "Failure preparing request") - return - } - - result, err = client.GetMetadataSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "GetMetadata", result.Response(), "Failure sending request") - return - } - - return -} - -// GetMetadataPreparer prepares the GetMetadata request. -func (client SubvolumesClient) GetMetadataPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName 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), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-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}/subvolumes/{subvolumeName}/getMetadata", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// GetMetadataSender sends the GetMetadata request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) GetMetadataSender(req *http.Request) (future SubvolumesGetMetadataFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// GetMetadataResponder handles the response to the GetMetadata request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) GetMetadataResponder(resp *http.Response) (result SubvolumeModel, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByVolume returns a list of the subvolumes in the 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 SubvolumesClient) ListByVolume(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SubvolumesListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.ListByVolume") - defer func() { - sc := -1 - if result.sl.Response.Response != nil { - sc = result.sl.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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "ListByVolume", err.Error()) - } - - result.fn = client.listByVolumeNextResults - req, err := client.ListByVolumePreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "ListByVolume", nil, "Failure preparing request") - return - } - - resp, err := client.ListByVolumeSender(req) - if err != nil { - result.sl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "ListByVolume", resp, "Failure sending request") - return - } - - result.sl, err = client.ListByVolumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "ListByVolume", resp, "Failure responding to request") - return - } - if result.sl.hasNextLink() && result.sl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListByVolumePreparer prepares the ListByVolume request. -func (client SubvolumesClient) ListByVolumePreparer(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 = "2021-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}/subvolumes", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByVolumeSender sends the ListByVolume request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) ListByVolumeSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByVolumeResponder handles the response to the ListByVolume request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) ListByVolumeResponder(resp *http.Response) (result SubvolumesList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listByVolumeNextResults retrieves the next set of results, if any. -func (client SubvolumesClient) listByVolumeNextResults(ctx context.Context, lastResults SubvolumesList) (result SubvolumesList, err error) { - req, err := lastResults.subvolumesListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "listByVolumeNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListByVolumeSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "listByVolumeNextResults", resp, "Failure sending next results request") - } - result, err = client.ListByVolumeResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "listByVolumeNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListByVolumeComplete enumerates all values, automatically crossing page boundaries as required. -func (client SubvolumesClient) ListByVolumeComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result SubvolumesListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.ListByVolume") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.ListByVolume(ctx, resourceGroupName, accountName, poolName, volumeName) - return -} - -// Update patch a subvolume -// Parameters: -// body - subvolume object supplied in the body of the operation. -// 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 -// subvolumeName - the name of the subvolume. -func (client SubvolumesClient) Update(ctx context.Context, body SubvolumePatchRequest, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName string) (result SubvolumesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/SubvolumesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: subvolumeName, - Constraints: []validation.Constraint{{Target: "subvolumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "subvolumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "subvolumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.SubvolumesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName, subvolumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.SubvolumesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client SubvolumesClient) UpdatePreparer(ctx context.Context, body SubvolumePatchRequest, resourceGroupName string, accountName string, poolName string, volumeName string, subvolumeName 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), - "subvolumeName": autorest.Encode("path", subvolumeName), - "volumeName": autorest.Encode("path", volumeName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client SubvolumesClient) UpdateSender(req *http.Request) (future SubvolumesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client SubvolumesClient) UpdateResponder(resp *http.Response) (result SubvolumeInfo, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/vaults.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/vaults.go deleted file mode 100644 index ee3222d17445..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/vaults.go +++ /dev/null @@ -1,116 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VaultsClient is the microsoft NetApp Files Azure Resource Provider specification -type VaultsClient struct { - BaseClient -} - -// NewVaultsClient creates an instance of the VaultsClient client. -func NewVaultsClient(subscriptionID string) VaultsClient { - return NewVaultsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVaultsClientWithBaseURI creates an instance of the VaultsClient 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 NewVaultsClientWithBaseURI(baseURI string, subscriptionID string) VaultsClient { - return VaultsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// List list vaults for a Netapp Account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client VaultsClient) List(ctx context.Context, resourceGroupName string, accountName string) (result VaultList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VaultsClient.List") - 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.VaultsClient", "List", err.Error()) - } - - req, err := client.ListPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure sending request") - return - } - - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VaultsClient", "List", resp, "Failure responding to request") - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VaultsClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/vaults", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VaultsClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VaultsClient) ListResponder(resp *http.Response) (result VaultList, 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/netapp/mgmt/2021-10-01/netapp/version.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/version.go deleted file mode 100644 index d254f8bece8a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/version.go +++ /dev/null @@ -1,19 +0,0 @@ -package netapp - -import "github.com/Azure/azure-sdk-for-go/version" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -// UserAgent returns the UserAgent string to use when sending http.Requests. -func UserAgent() string { - return "Azure-SDK-For-Go/" + Version() + " netapp/2021-10-01" -} - -// Version returns the semantic version (see http://semver.org) of the client. -func Version() string { - return version.Number -} diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumegroups.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumegroups.go deleted file mode 100644 index 65bc0539bda9..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumegroups.go +++ /dev/null @@ -1,397 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VolumeGroupsClient is the microsoft NetApp Files Azure Resource Provider specification -type VolumeGroupsClient struct { - BaseClient -} - -// NewVolumeGroupsClient creates an instance of the VolumeGroupsClient client. -func NewVolumeGroupsClient(subscriptionID string) VolumeGroupsClient { - return NewVolumeGroupsClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVolumeGroupsClientWithBaseURI creates an instance of the VolumeGroupsClient 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 NewVolumeGroupsClientWithBaseURI(baseURI string, subscriptionID string) VolumeGroupsClient { - return VolumeGroupsClient{NewWithBaseURI(baseURI, subscriptionID)} -} - -// Create create a volume group along with specified volumes -// Parameters: -// body - volume Group object supplied in the body of the operation. -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// volumeGroupName - the name of the volumeGroup -func (client VolumeGroupsClient) Create(ctx context.Context, body VolumeGroupDetails, resourceGroupName string, accountName string, volumeGroupName string) (result VolumeGroupsCreateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.Create") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: volumeGroupName, - Constraints: []validation.Constraint{{Target: "volumeGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "Create", err.Error()) - } - - req, err := client.CreatePreparer(ctx, body, resourceGroupName, accountName, volumeGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Create", nil, "Failure preparing request") - return - } - - result, err = client.CreateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Create", result.Response(), "Failure sending request") - return - } - - return -} - -// CreatePreparer prepares the Create request. -func (client VolumeGroupsClient) CreatePreparer(ctx context.Context, body VolumeGroupDetails, resourceGroupName string, accountName string, volumeGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeGroupName": autorest.Encode("path", volumeGroupName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateSender sends the Create request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) CreateSender(req *http.Request) (future VolumeGroupsCreateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateResponder handles the response to the Create request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) CreateResponder(resp *http.Response) (result VolumeGroupDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified volume group only if there are no volumes under volume group. -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// volumeGroupName - the name of the volumeGroup -func (client VolumeGroupsClient) Delete(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (result VolumeGroupsDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: volumeGroupName, - Constraints: []validation.Constraint{{Target: "volumeGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, volumeGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VolumeGroupsClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeGroupName": autorest.Encode("path", volumeGroupName), - } - - const APIVersion = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) DeleteSender(req *http.Request) (future VolumeGroupsDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// Get get details of the specified volume group -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// volumeGroupName - the name of the volumeGroup -func (client VolumeGroupsClient) Get(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (result VolumeGroupDetails, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: volumeGroupName, - Constraints: []validation.Constraint{{Target: "volumeGroupName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeGroupName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumeGroupsClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, volumeGroupName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VolumeGroupsClient) GetPreparer(ctx context.Context, resourceGroupName string, accountName string, volumeGroupName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - "volumeGroupName": autorest.Encode("path", volumeGroupName), - } - - const APIVersion = "2021-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}/volumeGroups/{volumeGroupName}", 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 VolumeGroupsClient) 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 VolumeGroupsClient) GetResponder(resp *http.Response) (result VolumeGroupDetails, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// ListByNetAppAccount list all volume groups for given account -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -func (client VolumeGroupsClient) ListByNetAppAccount(ctx context.Context, resourceGroupName string, accountName string) (result VolumeGroupList, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumeGroupsClient.ListByNetAppAccount") - 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.VolumeGroupsClient", "ListByNetAppAccount", err.Error()) - } - - req, err := client.ListByNetAppAccountPreparer(ctx, resourceGroupName, accountName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "ListByNetAppAccount", nil, "Failure preparing request") - return - } - - resp, err := client.ListByNetAppAccountSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "ListByNetAppAccount", resp, "Failure sending request") - return - } - - result, err = client.ListByNetAppAccountResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumeGroupsClient", "ListByNetAppAccount", resp, "Failure responding to request") - return - } - - return -} - -// ListByNetAppAccountPreparer prepares the ListByNetAppAccount request. -func (client VolumeGroupsClient) ListByNetAppAccountPreparer(ctx context.Context, resourceGroupName string, accountName string) (*http.Request, error) { - pathParameters := map[string]interface{}{ - "accountName": autorest.Encode("path", accountName), - "resourceGroupName": autorest.Encode("path", resourceGroupName), - "subscriptionId": autorest.Encode("path", client.SubscriptionID), - } - - const APIVersion = "2021-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}/volumeGroups", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListByNetAppAccountSender sends the ListByNetAppAccount request. The method will close the -// http.Response Body if it receives an error. -func (client VolumeGroupsClient) ListByNetAppAccountSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListByNetAppAccountResponder handles the response to the ListByNetAppAccount request. The method always -// closes the http.Response Body. -func (client VolumeGroupsClient) ListByNetAppAccountResponder(resp *http.Response) (result VolumeGroupList, 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/netapp/mgmt/2021-10-01/netapp/volumes.go b/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumes.go deleted file mode 100644 index 11016cd3a95a..000000000000 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp/volumes.go +++ /dev/null @@ -1,1422 +0,0 @@ -package netapp - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "context" - "github.com/Azure/go-autorest/autorest" - "github.com/Azure/go-autorest/autorest/azure" - "github.com/Azure/go-autorest/autorest/validation" - "github.com/Azure/go-autorest/tracing" - "net/http" -) - -// VolumesClient is the microsoft NetApp Files Azure Resource Provider specification -type VolumesClient struct { - BaseClient -} - -// NewVolumesClient creates an instance of the VolumesClient client. -func NewVolumesClient(subscriptionID string) VolumesClient { - return NewVolumesClientWithBaseURI(DefaultBaseURI, subscriptionID) -} - -// NewVolumesClientWithBaseURI creates an instance of the VolumesClient 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 NewVolumesClientWithBaseURI(baseURI string, subscriptionID string) VolumesClient { - 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 VolumesAuthorizeReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.AuthorizeReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, 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 - } - - result, err = client.AuthorizeReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "AuthorizeReplication", result.Response(), "Failure sending request") - return - } - - 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 = "2021-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) (future VolumesAuthorizeReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// 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, - 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 -// body - optional body to force break the replication. -func (client VolumesClient) BreakReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (result VolumesBreakReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.BreakReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "BreakReplication", err.Error()) - } - - req, err := client.BreakReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", nil, "Failure preparing request") - return - } - - result, err = client.BreakReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "BreakReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// BreakReplicationPreparer prepares the BreakReplication request. -func (client VolumesClient) BreakReplicationPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body *BreakReplicationRequest) (*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 = "2021-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}/breakReplication", pathParameters), - autorest.WithQueryParameters(queryParameters)) - if body != nil { - preparer = autorest.DecoratePreparer(preparer, - autorest.WithJSON(body)) - } - 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) (future VolumesBreakReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// 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, - 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. -// 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) CreateOrUpdate(ctx context.Context, body Volume, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesCreateOrUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.CreateOrUpdate") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.Location", Name: validation.Null, Rule: true, Chain: nil}, - {Target: "body.VolumeProperties", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.FileSystemID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.FileSystemID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.FileSystemID", 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.CreationToken", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.CreationToken", Name: validation.MaxLength, Rule: 80, Chain: nil}, - {Target: "body.VolumeProperties.CreationToken", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "body.VolumeProperties.CreationToken", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-]{0,79}$`, Chain: nil}, - }}, - {Target: "body.VolumeProperties.UsageThreshold", Name: validation.Null, Rule: true, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMaximum, Rule: int64(109951162777600), Chain: nil}, - {Target: "body.VolumeProperties.UsageThreshold", Name: validation.InclusiveMinimum, Rule: int64(107374182400), Chain: nil}, - }}, - {Target: "body.VolumeProperties.SnapshotID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.SnapshotID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.SnapshotID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.SnapshotID", 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.BackupID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.BackupID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.BackupID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.BackupID", 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.NetworkSiblingSetID", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.MaxLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.NetworkSiblingSetID", Name: validation.MinLength, Rule: 36, Chain: nil}, - {Target: "body.VolumeProperties.NetworkSiblingSetID", 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.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}}}, - }}, - {Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.InclusiveMaximum, Rule: int64(63), Chain: nil}, - {Target: "body.VolumeProperties.CoolnessPeriod", Name: validation.InclusiveMinimum, Rule: int64(7), Chain: nil}, - }}, - {Target: "body.VolumeProperties.UnixPermissions", Name: validation.Null, Rule: false, - Chain: []validation.Constraint{{Target: "body.VolumeProperties.UnixPermissions", Name: validation.MaxLength, Rule: 4, Chain: nil}, - {Target: "body.VolumeProperties.UnixPermissions", Name: validation.MinLength, Rule: 4, Chain: nil}, - }}, - }}}}, - {TargetValue: resourceGroupName, - Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, - {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "CreateOrUpdate", err.Error()) - } - - req, err := client.CreateOrUpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") - return - } - - result, err = client.CreateOrUpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "CreateOrUpdate", result.Response(), "Failure sending request") - return - } - - return -} - -// CreateOrUpdatePreparer prepares the CreateOrUpdate request. -func (client VolumesClient) CreateOrUpdatePreparer(ctx context.Context, body Volume, 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 = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Etag = nil - body.Type = nil - body.SystemData = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPut(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) CreateOrUpdateSender(req *http.Request) (future VolumesCreateOrUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always -// closes the http.Response Body. -func (client VolumesClient) CreateOrUpdateResponder(resp *http.Response) (result Volume, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusCreated, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// Delete delete the specified 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 -// forceDelete - an option to force delete the volume. Will cleanup resources connected to the particular -// volume -func (client VolumesClient) Delete(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, forceDelete *bool) (result VolumesDeleteFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Delete") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Delete", err.Error()) - } - - req, err := client.DeletePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, forceDelete) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", nil, "Failure preparing request") - return - } - - result, err = client.DeleteSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Delete", result.Response(), "Failure sending request") - return - } - - return -} - -// DeletePreparer prepares the Delete request. -func (client VolumesClient) DeletePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, forceDelete *bool) (*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 = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - if forceDelete != nil { - queryParameters["forceDelete"] = autorest.Encode("query", *forceDelete) - } - - preparer := autorest.CreatePreparer( - autorest.AsDelete(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// DeleteSender sends the Delete request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) DeleteSender(req *http.Request) (future VolumesDeleteFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// DeleteResponder handles the response to the Delete request. The method always -// closes the http.Response Body. -func (client VolumesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent), - autorest.ByClosing()) - result.Response = resp - return -} - -// 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 VolumesDeleteReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.DeleteReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, 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 - } - - result, err = client.DeleteReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "DeleteReplication", result.Response(), "Failure sending request") - return - } - - 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 = "2021-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) (future VolumesDeleteReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// 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, - 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. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -// volumeName - the name of the volume -func (client VolumesClient) Get(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result Volume, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Get") - defer func() { - sc := -1 - if result.Response.Response != nil { - sc = result.Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Get", err.Error()) - } - - req, err := client.GetPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", nil, "Failure preparing request") - return - } - - resp, err := client.GetSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure sending request") - return - } - - result, err = client.GetResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Get", resp, "Failure responding to request") - return - } - - return -} - -// GetPreparer prepares the Get request. -func (client VolumesClient) GetPreparer(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 = "2021-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}", 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 VolumesClient) 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 VolumesClient) GetResponder(resp *http.Response) (result Volume, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// List list all volumes within the capacity pool -// Parameters: -// resourceGroupName - the name of the resource group. -// accountName - the name of the NetApp account -// poolName - the name of the capacity pool -func (client VolumesClient) List(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListPage, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") - defer func() { - sc := -1 - if result.vl.Response.Response != nil { - sc = result.vl.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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "List", err.Error()) - } - - result.fn = client.listNextResults - req, err := client.ListPreparer(ctx, resourceGroupName, accountName, poolName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", nil, "Failure preparing request") - return - } - - resp, err := client.ListSender(req) - if err != nil { - result.vl.Response = autorest.Response{Response: resp} - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure sending request") - return - } - - result.vl, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "List", resp, "Failure responding to request") - return - } - if result.vl.hasNextLink() && result.vl.IsEmpty() { - err = result.NextWithContext(ctx) - return - } - - return -} - -// ListPreparer prepares the List request. -func (client VolumesClient) ListPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName 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), - } - - const APIVersion = "2021-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", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ListSender sends the List request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) ListSender(req *http.Request) (*http.Response, error) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// ListResponder handles the response to the List request. The method always -// closes the http.Response Body. -func (client VolumesClient) ListResponder(resp *http.Response) (result VolumeList, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} - -// listNextResults retrieves the next set of results, if any. -func (client VolumesClient) listNextResults(ctx context.Context, lastResults VolumeList) (result VolumeList, err error) { - req, err := lastResults.volumeListPreparer(ctx) - if err != nil { - return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", nil, "Failure preparing next results request") - } - if req == nil { - return - } - resp, err := client.ListSender(req) - if err != nil { - result.Response = autorest.Response{Response: resp} - return result, autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure sending next results request") - } - result, err = client.ListResponder(resp) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "listNextResults", resp, "Failure responding to next results request") - } - return -} - -// ListComplete enumerates all values, automatically crossing page boundaries as required. -func (client VolumesClient) ListComplete(ctx context.Context, resourceGroupName string, accountName string, poolName string) (result VolumeListIterator, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.List") - defer func() { - sc := -1 - if result.Response().Response.Response != nil { - sc = result.page.Response().Response.Response.StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - result.page, err = client.List(ctx, resourceGroupName, accountName, poolName) - return -} - -// PoolChange moves volume to another pool -// 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 - move volume to the pool supplied in the body of the operation. -func (client VolumesClient) PoolChange(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (result VolumesPoolChangeFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.PoolChange") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: body, - Constraints: []validation.Constraint{{Target: "body.NewPoolResourceID", Name: validation.Null, Rule: true, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "PoolChange", err.Error()) - } - - req, err := client.PoolChangePreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", nil, "Failure preparing request") - return - } - - result, err = client.PoolChangeSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "PoolChange", result.Response(), "Failure sending request") - return - } - - return -} - -// PoolChangePreparer prepares the PoolChange request. -func (client VolumesClient) PoolChangePreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body PoolChangeRequest) (*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 = "2021-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}/poolChange", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// PoolChangeSender sends the PoolChange request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) PoolChangeSender(req *http.Request) (future VolumesPoolChangeFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// PoolChangeResponder handles the response to the PoolChange request. The method always -// closes the http.Response Body. -func (client VolumesClient) PoolChangeResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// ReInitializeReplication re-Initializes 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) ReInitializeReplication(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesReInitializeReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ReInitializeReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "ReInitializeReplication", err.Error()) - } - - req, err := client.ReInitializeReplicationPreparer(ctx, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", nil, "Failure preparing request") - return - } - - result, err = client.ReInitializeReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ReInitializeReplication", result.Response(), "Failure sending request") - return - } - - return -} - -// ReInitializeReplicationPreparer prepares the ReInitializeReplication request. -func (client VolumesClient) ReInitializeReplicationPreparer(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 = "2021-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}/reinitializeReplication", pathParameters), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// ReInitializeReplicationSender sends the ReInitializeReplication request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) ReInitializeReplicationSender(req *http.Request) (future VolumesReInitializeReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// ReInitializeReplicationResponder handles the response to the ReInitializeReplication request. The method always -// closes the http.Response Body. -func (client VolumesClient) ReInitializeReplicationResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, 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 - } - - 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 = "2021-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) { - return client.Send(req, azure.DoRetryWithRegistration(client.Client)) -} - -// 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, - 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 destination to source. -// 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 VolumesResyncReplicationFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.ResyncReplication") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, 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 - } - - result, err = client.ResyncReplicationSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "ResyncReplication", result.Response(), "Failure sending request") - return - } - - 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 = "2021-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) (future VolumesResyncReplicationFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// 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, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Revert revert a volume to the snapshot specified in the body -// 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 - object for snapshot to revert supplied in the body of the operation. -func (client VolumesClient) Revert(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (result VolumesRevertFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Revert") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Revert", err.Error()) - } - - req, err := client.RevertPreparer(ctx, resourceGroupName, accountName, poolName, volumeName, body) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", nil, "Failure preparing request") - return - } - - result, err = client.RevertSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Revert", result.Response(), "Failure sending request") - return - } - - return -} - -// RevertPreparer prepares the Revert request. -func (client VolumesClient) RevertPreparer(ctx context.Context, resourceGroupName string, accountName string, poolName string, volumeName string, body VolumeRevert) (*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 = "2021-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}/revert", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// RevertSender sends the Revert request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) RevertSender(req *http.Request) (future VolumesRevertFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// RevertResponder handles the response to the Revert request. The method always -// closes the http.Response Body. -func (client VolumesClient) RevertResponder(resp *http.Response) (result autorest.Response, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByClosing()) - result.Response = resp - return -} - -// Update patch the specified volume -// Parameters: -// body - volume object supplied in the body of the operation. -// 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) Update(ctx context.Context, body VolumePatch, resourceGroupName string, accountName string, poolName string, volumeName string) (result VolumesUpdateFuture, err error) { - if tracing.IsEnabled() { - ctx = tracing.StartSpan(ctx, fqdn+"/VolumesClient.Update") - defer func() { - sc := -1 - if result.FutureAPI != nil && result.FutureAPI.Response() != nil { - sc = result.FutureAPI.Response().StatusCode - } - tracing.EndSpan(ctx, sc, err) - }() - } - if err := validation.Validate([]validation.Validation{ - {TargetValue: 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}}}, - {TargetValue: poolName, - Constraints: []validation.Constraint{{Target: "poolName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "poolName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "poolName", Name: validation.Pattern, Rule: `^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}, - {TargetValue: volumeName, - Constraints: []validation.Constraint{{Target: "volumeName", Name: validation.MaxLength, Rule: 64, Chain: nil}, - {Target: "volumeName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "volumeName", Name: validation.Pattern, Rule: `^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$`, Chain: nil}}}}); err != nil { - return result, validation.NewError("netapp.VolumesClient", "Update", err.Error()) - } - - req, err := client.UpdatePreparer(ctx, body, resourceGroupName, accountName, poolName, volumeName) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", nil, "Failure preparing request") - return - } - - result, err = client.UpdateSender(req) - if err != nil { - err = autorest.NewErrorWithError(err, "netapp.VolumesClient", "Update", result.Response(), "Failure sending request") - return - } - - return -} - -// UpdatePreparer prepares the Update request. -func (client VolumesClient) UpdatePreparer(ctx context.Context, body VolumePatch, 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 = "2021-10-01" - queryParameters := map[string]interface{}{ - "api-version": APIVersion, - } - - body.ID = nil - body.Name = nil - body.Type = nil - preparer := autorest.CreatePreparer( - autorest.AsContentType("application/json; charset=utf-8"), - autorest.AsPatch(), - autorest.WithBaseURL(client.BaseURI), - autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}", pathParameters), - autorest.WithJSON(body), - autorest.WithQueryParameters(queryParameters)) - return preparer.Prepare((&http.Request{}).WithContext(ctx)) -} - -// UpdateSender sends the Update request. The method will close the -// http.Response Body if it receives an error. -func (client VolumesClient) UpdateSender(req *http.Request) (future VolumesUpdateFuture, err error) { - var resp *http.Response - future.FutureAPI = &azure.Future{} - resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) - if err != nil { - return - } - var azf azure.Future - azf, err = azure.NewFutureFromResponse(resp) - future.FutureAPI = &azf - future.Result = future.result - return -} - -// UpdateResponder handles the response to the Update request. The method always -// closes the http.Response Body. -func (client VolumesClient) UpdateResponder(resp *http.Response) (result Volume, err error) { - err = autorest.Respond( - resp, - azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), - autorest.ByUnmarshallingJSON(&result), - autorest.ByClosing()) - result.Response = autorest.Response{Response: resp} - return -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/README.md new file mode 100644 index 000000000000..a47f3c6bf12f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools` Documentation + +The `capacitypools` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools" +``` + + +### Client Initialization + +```go +client := capacitypools.NewCapacityPoolsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityPoolsClient.PoolsCreateOrUpdate` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +payload := capacitypools.CapacityPool{ + // ... +} + + +if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsDelete` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsGet` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +read, err := client.PoolsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsList` + +```go +ctx := context.TODO() +id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +// alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination +items, err := client.PoolsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityPoolsClient.PoolsUpdate` + +```go +ctx := context.TODO() +id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +payload := capacitypools.CapacityPoolPatch{ + // ... +} + + +if err := client.PoolsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/client.go new file mode 100644 index 000000000000..d31b6b301a25 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/client.go @@ -0,0 +1,18 @@ +package capacitypools + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityPoolsClient struct { + Client autorest.Client + baseUri string +} + +func NewCapacityPoolsClientWithBaseURI(endpoint string) CapacityPoolsClient { + return CapacityPoolsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/constants.go new file mode 100644 index 000000000000..4856e8e79bc3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/constants.go @@ -0,0 +1,96 @@ +package capacitypools + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EncryptionType string + +const ( + EncryptionTypeDouble EncryptionType = "Double" + EncryptionTypeSingle EncryptionType = "Single" +) + +func PossibleValuesForEncryptionType() []string { + return []string{ + string(EncryptionTypeDouble), + string(EncryptionTypeSingle), + } +} + +func parseEncryptionType(input string) (*EncryptionType, error) { + vals := map[string]EncryptionType{ + "double": EncryptionTypeDouble, + "single": EncryptionTypeSingle, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EncryptionType(input) + return &out, nil +} + +type QosType string + +const ( + QosTypeAuto QosType = "Auto" + QosTypeManual QosType = "Manual" +) + +func PossibleValuesForQosType() []string { + return []string{ + string(QosTypeAuto), + string(QosTypeManual), + } +} + +func parseQosType(input string) (*QosType, error) { + vals := map[string]QosType{ + "auto": QosTypeAuto, + "manual": QosTypeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := QosType(input) + return &out, nil +} + +type ServiceLevel string + +const ( + ServiceLevelPremium ServiceLevel = "Premium" + ServiceLevelStandard ServiceLevel = "Standard" + ServiceLevelStandardZRS ServiceLevel = "StandardZRS" + ServiceLevelUltra ServiceLevel = "Ultra" +) + +func PossibleValuesForServiceLevel() []string { + return []string{ + string(ServiceLevelPremium), + string(ServiceLevelStandard), + string(ServiceLevelStandardZRS), + string(ServiceLevelUltra), + } +} + +func parseServiceLevel(input string) (*ServiceLevel, error) { + vals := map[string]ServiceLevel{ + "premium": ServiceLevelPremium, + "standard": ServiceLevelStandard, + "standardzrs": ServiceLevelStandardZRS, + "ultra": ServiceLevelUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceLevel(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_capacitypool.go new file mode 100644 index 000000000000..a50e29408397 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_capacitypool.go @@ -0,0 +1,137 @@ +package capacitypools + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CapacityPoolId{} + +// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool +type CapacityPoolId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string +} + +// NewCapacityPoolID returns a new CapacityPoolId struct +func NewCapacityPoolID(subscriptionId string, resourceGroupName string, accountName string, poolName string) CapacityPoolId { + return CapacityPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + } +} + +// ParseCapacityPoolID parses 'input' into a CapacityPoolId +func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId +// note: this method should only be used for API response data and not user input +func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID +func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCapacityPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Pool ID +func (id CapacityPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID +func (id CapacityPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + } +} + +// String returns a human-readable description of this Capacity Pool ID +func (id CapacityPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + } + return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_netappaccount.go new file mode 100644 index 000000000000..86bd7fcada46 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/id_netappaccount.go @@ -0,0 +1,124 @@ +package capacitypools + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseNetAppAccountID parses 'input' into a NetAppAccountId +func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetAppAccountIDInsensitively parses 'input' case-insensitively into a NetAppAccountId +// note: this method should only be used for API response data and not user input +func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID +func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetAppAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Net App Account ID +func (id NetAppAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Net App Account ID +func (id NetAppAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Net App Account ID +func (id NetAppAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolscreateorupdate_autorest.go new file mode 100644 index 000000000000..72891f7b9dfb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoolsCreateOrUpdate ... +func (c CapacityPoolsClient) PoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (result PoolsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForPoolsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoolsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoolsCreateOrUpdateThenPoll performs PoolsCreateOrUpdate then polls until it's completed +func (c CapacityPoolsClient) PoolsCreateOrUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPool) error { + result, err := c.PoolsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PoolsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoolsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForPoolsCreateOrUpdate prepares the PoolsCreateOrUpdate request. +func (c CapacityPoolsClient) preparerForPoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoolsCreateOrUpdate sends the PoolsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c CapacityPoolsClient) senderForPoolsCreateOrUpdate(ctx context.Context, req *http.Request) (future PoolsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsdelete_autorest.go new file mode 100644 index 000000000000..61d0e6104b15 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsdelete_autorest.go @@ -0,0 +1,78 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoolsDelete ... +func (c CapacityPoolsClient) PoolsDelete(ctx context.Context, id CapacityPoolId) (result PoolsDeleteOperationResponse, err error) { + req, err := c.preparerForPoolsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoolsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoolsDeleteThenPoll performs PoolsDelete then polls until it's completed +func (c CapacityPoolsClient) PoolsDeleteThenPoll(ctx context.Context, id CapacityPoolId) error { + result, err := c.PoolsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing PoolsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoolsDelete: %+v", err) + } + + return nil +} + +// preparerForPoolsDelete prepares the PoolsDelete request. +func (c CapacityPoolsClient) preparerForPoolsDelete(ctx context.Context, id CapacityPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoolsDelete sends the PoolsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c CapacityPoolsClient) senderForPoolsDelete(ctx context.Context, req *http.Request) (future PoolsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsget_autorest.go new file mode 100644 index 000000000000..d2725693da9d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsget_autorest.go @@ -0,0 +1,67 @@ +package capacitypools + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsGetOperationResponse struct { + HttpResponse *http.Response + Model *CapacityPool +} + +// PoolsGet ... +func (c CapacityPoolsClient) PoolsGet(ctx context.Context, id CapacityPoolId) (result PoolsGetOperationResponse, err error) { + req, err := c.preparerForPoolsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoolsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForPoolsGet prepares the PoolsGet request. +func (c CapacityPoolsClient) preparerForPoolsGet(ctx context.Context, id CapacityPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPoolsGet handles the response to the PoolsGet request. The method always +// closes the http.Response Body. +func (c CapacityPoolsClient) responderForPoolsGet(resp *http.Response) (result PoolsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolslist_autorest.go new file mode 100644 index 000000000000..25c06a45e9bd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolslist_autorest.go @@ -0,0 +1,186 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsListOperationResponse struct { + HttpResponse *http.Response + Model *[]CapacityPool + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (PoolsListOperationResponse, error) +} + +type PoolsListCompleteResult struct { + Items []CapacityPool +} + +func (r PoolsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r PoolsListOperationResponse) LoadMore(ctx context.Context) (resp PoolsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// PoolsList ... +func (c CapacityPoolsClient) PoolsList(ctx context.Context, id NetAppAccountId) (resp PoolsListOperationResponse, err error) { + req, err := c.preparerForPoolsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForPoolsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// PoolsListComplete retrieves all of the results into a single object +func (c CapacityPoolsClient) PoolsListComplete(ctx context.Context, id NetAppAccountId) (PoolsListCompleteResult, error) { + return c.PoolsListCompleteMatchingPredicate(ctx, id, CapacityPoolOperationPredicate{}) +} + +// PoolsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c CapacityPoolsClient) PoolsListCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate CapacityPoolOperationPredicate) (resp PoolsListCompleteResult, err error) { + items := make([]CapacityPool, 0) + + page, err := c.PoolsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := PoolsListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForPoolsList prepares the PoolsList request. +func (c CapacityPoolsClient) preparerForPoolsList(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/capacityPools", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForPoolsListWithNextLink prepares the PoolsList request with the given nextLink token. +func (c CapacityPoolsClient) preparerForPoolsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForPoolsList handles the response to the PoolsList request. The method always +// closes the http.Response Body. +func (c CapacityPoolsClient) responderForPoolsList(resp *http.Response) (result PoolsListOperationResponse, err error) { + type page struct { + Values []CapacityPool `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result PoolsListOperationResponse, err error) { + req, err := c.preparerForPoolsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForPoolsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsupdate_autorest.go new file mode 100644 index 000000000000..680bc19748a1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/method_poolsupdate_autorest.go @@ -0,0 +1,79 @@ +package capacitypools + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// PoolsUpdate ... +func (c CapacityPoolsClient) PoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (result PoolsUpdateOperationResponse, err error) { + req, err := c.preparerForPoolsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForPoolsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "capacitypools.CapacityPoolsClient", "PoolsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// PoolsUpdateThenPoll performs PoolsUpdate then polls until it's completed +func (c CapacityPoolsClient) PoolsUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) error { + result, err := c.PoolsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PoolsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after PoolsUpdate: %+v", err) + } + + return nil +} + +// preparerForPoolsUpdate prepares the PoolsUpdate request. +func (c CapacityPoolsClient) preparerForPoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForPoolsUpdate sends the PoolsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c CapacityPoolsClient) senderForPoolsUpdate(ctx context.Context, req *http.Request) (future PoolsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypool.go new file mode 100644 index 000000000000..f5d6f1ea86df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypool.go @@ -0,0 +1,19 @@ +package capacitypools + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityPool struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties PoolProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypoolpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypoolpatch.go new file mode 100644 index 000000000000..46abcde6b330 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_capacitypoolpatch.go @@ -0,0 +1,13 @@ +package capacitypools + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityPoolPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PoolPatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolpatchproperties.go new file mode 100644 index 000000000000..071dba445599 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolpatchproperties.go @@ -0,0 +1,9 @@ +package capacitypools + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolPatchProperties struct { + QosType *QosType `json:"qosType,omitempty"` + Size *int64 `json:"size,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolproperties.go new file mode 100644 index 000000000000..a1fee733fb48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/model_poolproperties.go @@ -0,0 +1,16 @@ +package capacitypools + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PoolProperties struct { + CoolAccess *bool `json:"coolAccess,omitempty"` + EncryptionType *EncryptionType `json:"encryptionType,omitempty"` + PoolId *string `json:"poolId,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + QosType *QosType `json:"qosType,omitempty"` + ServiceLevel ServiceLevel `json:"serviceLevel"` + Size int64 `json:"size"` + TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` + UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/predicates.go new file mode 100644 index 000000000000..67e2199aa2cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/predicates.go @@ -0,0 +1,34 @@ +package capacitypools + +type CapacityPoolOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p CapacityPoolOperationPredicate) Matches(input CapacityPool) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/version.go new file mode 100644 index 000000000000..c647e1604368 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools/version.go @@ -0,0 +1,12 @@ +package capacitypools + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/capacitypools/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/README.md new file mode 100644 index 000000000000..487820e90f62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts` Documentation + +The `netappaccounts` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts" +``` + + +### Client Initialization + +```go +client := netappaccounts.NewNetAppAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NetAppAccountsClient.AccountsCreateOrUpdate` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := netappaccounts.NetAppAccount{ + // ... +} + + +if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsDelete` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsGet` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.AccountsGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsList` + +```go +ctx := context.TODO() +id := netappaccounts.NewResourceGroupID() + +// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination +items, err := client.AccountsListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsListBySubscription` + +```go +ctx := context.TODO() +id := netappaccounts.NewSubscriptionID() + +// alternatively `client.AccountsListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.AccountsListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `NetAppAccountsClient.AccountsUpdate` + +```go +ctx := context.TODO() +id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +payload := netappaccounts.NetAppAccountPatch{ + // ... +} + + +if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/client.go new file mode 100644 index 000000000000..1a10ce8e9b65 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/client.go @@ -0,0 +1,18 @@ +package netappaccounts + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetAppAccountsClient struct { + Client autorest.Client + baseUri string +} + +func NewNetAppAccountsClientWithBaseURI(endpoint string) NetAppAccountsClient { + return NetAppAccountsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/constants.go new file mode 100644 index 000000000000..6e41970873a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/constants.go @@ -0,0 +1,43 @@ +package netappaccounts + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveDirectoryStatus string + +const ( + ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" + ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" + ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" + ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" + ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" +) + +func PossibleValuesForActiveDirectoryStatus() []string { + return []string{ + string(ActiveDirectoryStatusCreated), + string(ActiveDirectoryStatusDeleted), + string(ActiveDirectoryStatusError), + string(ActiveDirectoryStatusInUse), + string(ActiveDirectoryStatusUpdating), + } +} + +func parseActiveDirectoryStatus(input string) (*ActiveDirectoryStatus, error) { + vals := map[string]ActiveDirectoryStatus{ + "created": ActiveDirectoryStatusCreated, + "deleted": ActiveDirectoryStatusDeleted, + "error": ActiveDirectoryStatusError, + "inuse": ActiveDirectoryStatusInUse, + "updating": ActiveDirectoryStatusUpdating, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ActiveDirectoryStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/id_netappaccount.go new file mode 100644 index 000000000000..68e53f4815fc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/id_netappaccount.go @@ -0,0 +1,124 @@ +package netappaccounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseNetAppAccountID parses 'input' into a NetAppAccountId +func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetAppAccountIDInsensitively parses 'input' case-insensitively into a NetAppAccountId +// note: this method should only be used for API response data and not user input +func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID +func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetAppAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Net App Account ID +func (id NetAppAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Net App Account ID +func (id NetAppAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Net App Account ID +func (id NetAppAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountscreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountscreateorupdate_autorest.go new file mode 100644 index 000000000000..b192ede4f692 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountscreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsCreateOrUpdate ... +func (c NetAppAccountsClient) AccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (result AccountsCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForAccountsCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsCreateOrUpdateThenPoll performs AccountsCreateOrUpdate then polls until it's completed +func (c NetAppAccountsClient) AccountsCreateOrUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccount) error { + result, err := c.AccountsCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccountsCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForAccountsCreateOrUpdate prepares the AccountsCreateOrUpdate request. +func (c NetAppAccountsClient) preparerForAccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsCreateOrUpdate sends the AccountsCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NetAppAccountsClient) senderForAccountsCreateOrUpdate(ctx context.Context, req *http.Request) (future AccountsCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsdelete_autorest.go new file mode 100644 index 000000000000..4506db44c634 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsdelete_autorest.go @@ -0,0 +1,78 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsDelete ... +func (c NetAppAccountsClient) AccountsDelete(ctx context.Context, id NetAppAccountId) (result AccountsDeleteOperationResponse, err error) { + req, err := c.preparerForAccountsDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed +func (c NetAppAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id NetAppAccountId) error { + result, err := c.AccountsDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing AccountsDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsDelete: %+v", err) + } + + return nil +} + +// preparerForAccountsDelete prepares the AccountsDelete request. +func (c NetAppAccountsClient) preparerForAccountsDelete(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsDelete sends the AccountsDelete request. The method will close the +// http.Response Body if it receives an error. +func (c NetAppAccountsClient) senderForAccountsDelete(ctx context.Context, req *http.Request) (future AccountsDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsget_autorest.go new file mode 100644 index 000000000000..1c1edc04ccfb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsget_autorest.go @@ -0,0 +1,67 @@ +package netappaccounts + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsGetOperationResponse struct { + HttpResponse *http.Response + Model *NetAppAccount +} + +// AccountsGet ... +func (c NetAppAccountsClient) AccountsGet(ctx context.Context, id NetAppAccountId) (result AccountsGetOperationResponse, err error) { + req, err := c.preparerForAccountsGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForAccountsGet prepares the AccountsGet request. +func (c NetAppAccountsClient) preparerForAccountsGet(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsGet handles the response to the AccountsGet request. The method always +// closes the http.Response Body. +func (c NetAppAccountsClient) responderForAccountsGet(resp *http.Response) (result AccountsGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslist_autorest.go new file mode 100644 index 000000000000..dd93604fbcd5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslist_autorest.go @@ -0,0 +1,187 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListOperationResponse struct { + HttpResponse *http.Response + Model *[]NetAppAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (AccountsListOperationResponse, error) +} + +type AccountsListCompleteResult struct { + Items []NetAppAccount +} + +func (r AccountsListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r AccountsListOperationResponse) LoadMore(ctx context.Context) (resp AccountsListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// AccountsList ... +func (c NetAppAccountsClient) AccountsList(ctx context.Context, id commonids.ResourceGroupId) (resp AccountsListOperationResponse, err error) { + req, err := c.preparerForAccountsList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForAccountsList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// AccountsListComplete retrieves all of the results into a single object +func (c NetAppAccountsClient) AccountsListComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListCompleteResult, error) { + return c.AccountsListCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) +} + +// AccountsListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NetAppAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetAppAccountOperationPredicate) (resp AccountsListCompleteResult, err error) { + items := make([]NetAppAccount, 0) + + page, err := c.AccountsList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := AccountsListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForAccountsList prepares the AccountsList request. +func (c NetAppAccountsClient) preparerForAccountsList(ctx context.Context, id commonids.ResourceGroupId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForAccountsListWithNextLink prepares the AccountsList request with the given nextLink token. +func (c NetAppAccountsClient) preparerForAccountsListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsList handles the response to the AccountsList request. The method always +// closes the http.Response Body. +func (c NetAppAccountsClient) responderForAccountsList(resp *http.Response) (result AccountsListOperationResponse, err error) { + type page struct { + Values []NetAppAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListOperationResponse, err error) { + req, err := c.preparerForAccountsListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslistbysubscription_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslistbysubscription_autorest.go new file mode 100644 index 000000000000..bd65578f1751 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountslistbysubscription_autorest.go @@ -0,0 +1,187 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + Model *[]NetAppAccount + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (AccountsListBySubscriptionOperationResponse, error) +} + +type AccountsListBySubscriptionCompleteResult struct { + Items []NetAppAccount +} + +func (r AccountsListBySubscriptionOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r AccountsListBySubscriptionOperationResponse) LoadMore(ctx context.Context) (resp AccountsListBySubscriptionOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// AccountsListBySubscription ... +func (c NetAppAccountsClient) AccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (resp AccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForAccountsListBySubscription(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForAccountsListBySubscription(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// AccountsListBySubscriptionComplete retrieves all of the results into a single object +func (c NetAppAccountsClient) AccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListBySubscriptionCompleteResult, error) { + return c.AccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) +} + +// AccountsListBySubscriptionCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c NetAppAccountsClient) AccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetAppAccountOperationPredicate) (resp AccountsListBySubscriptionCompleteResult, err error) { + items := make([]NetAppAccount, 0) + + page, err := c.AccountsListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := AccountsListBySubscriptionCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForAccountsListBySubscription prepares the AccountsListBySubscription request. +func (c NetAppAccountsClient) preparerForAccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForAccountsListBySubscriptionWithNextLink prepares the AccountsListBySubscription request with the given nextLink token. +func (c NetAppAccountsClient) preparerForAccountsListBySubscriptionWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForAccountsListBySubscription handles the response to the AccountsListBySubscription request. The method always +// closes the http.Response Body. +func (c NetAppAccountsClient) responderForAccountsListBySubscription(resp *http.Response) (result AccountsListBySubscriptionOperationResponse, err error) { + type page struct { + Values []NetAppAccount `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result AccountsListBySubscriptionOperationResponse, err error) { + req, err := c.preparerForAccountsListBySubscriptionWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForAccountsListBySubscription(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsListBySubscription", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsupdate_autorest.go new file mode 100644 index 000000000000..8ed5cd37c4ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/method_accountsupdate_autorest.go @@ -0,0 +1,79 @@ +package netappaccounts + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountsUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// AccountsUpdate ... +func (c NetAppAccountsClient) AccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (result AccountsUpdateOperationResponse, err error) { + req, err := c.preparerForAccountsUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForAccountsUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "netappaccounts.NetAppAccountsClient", "AccountsUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed +func (c NetAppAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) error { + result, err := c.AccountsUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AccountsUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after AccountsUpdate: %+v", err) + } + + return nil +} + +// preparerForAccountsUpdate prepares the AccountsUpdate request. +func (c NetAppAccountsClient) preparerForAccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForAccountsUpdate sends the AccountsUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c NetAppAccountsClient) senderForAccountsUpdate(ctx context.Context, req *http.Request) (future AccountsUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountencryption.go new file mode 100644 index 000000000000..39a9282ce500 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountencryption.go @@ -0,0 +1,8 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountEncryption struct { + KeySource *string `json:"keySource,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountproperties.go new file mode 100644 index 000000000000..b158b47fc946 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_accountproperties.go @@ -0,0 +1,10 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountProperties struct { + ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` + Encryption *AccountEncryption `json:"encryption,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_activedirectory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_activedirectory.go new file mode 100644 index 000000000000..da90d13da0a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_activedirectory.go @@ -0,0 +1,29 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ActiveDirectory struct { + ActiveDirectoryId *string `json:"activeDirectoryId,omitempty"` + AdName *string `json:"adName,omitempty"` + Administrators *[]string `json:"administrators,omitempty"` + AesEncryption *bool `json:"aesEncryption,omitempty"` + AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` + BackupOperators *[]string `json:"backupOperators,omitempty"` + Dns *string `json:"dns,omitempty"` + Domain *string `json:"domain,omitempty"` + EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` + KdcIP *string `json:"kdcIP,omitempty"` + LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` + LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` + LdapSigning *bool `json:"ldapSigning,omitempty"` + OrganizationalUnit *string `json:"organizationalUnit,omitempty"` + Password *string `json:"password,omitempty"` + SecurityOperators *[]string `json:"securityOperators,omitempty"` + ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` + Site *string `json:"site,omitempty"` + SmbServerName *string `json:"smbServerName,omitempty"` + Status *ActiveDirectoryStatus `json:"status,omitempty"` + StatusDetails *string `json:"statusDetails,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_ldapsearchscopeopt.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_ldapsearchscopeopt.go new file mode 100644 index 000000000000..c476b0f0875f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_ldapsearchscopeopt.go @@ -0,0 +1,10 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LdapSearchScopeOpt struct { + GroupDN *string `json:"groupDN,omitempty"` + GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` + UserDN *string `json:"userDN,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccount.go new file mode 100644 index 000000000000..ec2ed4aa10c5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccount.go @@ -0,0 +1,19 @@ +package netappaccounts + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetAppAccount struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccountpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccountpatch.go new file mode 100644 index 000000000000..d3c6c1efcc20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/model_netappaccountpatch.go @@ -0,0 +1,13 @@ +package netappaccounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetAppAccountPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *AccountProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/predicates.go new file mode 100644 index 000000000000..cc139fd85c4a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/predicates.go @@ -0,0 +1,34 @@ +package netappaccounts + +type NetAppAccountOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p NetAppAccountOperationPredicate) Matches(input NetAppAccount) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/version.go new file mode 100644 index 000000000000..3de2667a1a82 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts/version.go @@ -0,0 +1,12 @@ +package netappaccounts + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/netappaccounts/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/README.md new file mode 100644 index 000000000000..802de9b9653a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/README.md @@ -0,0 +1,102 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy` Documentation + +The `snapshotpolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy" +``` + + +### Client Initialization + +```go +client := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesCreate` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +payload := snapshotpolicy.SnapshotPolicy{ + // ... +} + + +read, err := client.SnapshotPoliciesCreate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesDelete` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesGet` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +read, err := client.SnapshotPoliciesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesList` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue") + +read, err := client.SnapshotPoliciesList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesUpdate` + +```go +ctx := context.TODO() +id := snapshotpolicy.NewSnapshotPoliciesID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "snapshotPolicyValue") + +payload := snapshotpolicy.SnapshotPolicyPatch{ + // ... +} + + +if err := client.SnapshotPoliciesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/client.go new file mode 100644 index 000000000000..63c20fd6ea4d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/client.go @@ -0,0 +1,18 @@ +package snapshotpolicy + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicyClient struct { + Client autorest.Client + baseUri string +} + +func NewSnapshotPolicyClientWithBaseURI(endpoint string) SnapshotPolicyClient { + return SnapshotPolicyClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_netappaccount.go new file mode 100644 index 000000000000..726c28f92e9c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_netappaccount.go @@ -0,0 +1,124 @@ +package snapshotpolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, accountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseNetAppAccountID parses 'input' into a NetAppAccountId +func ParseNetAppAccountID(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseNetAppAccountIDInsensitively parses 'input' case-insensitively into a NetAppAccountId +// note: this method should only be used for API response data and not user input +func ParseNetAppAccountIDInsensitively(input string) (*NetAppAccountId, error) { + parser := resourceids.NewParserFromResourceIdType(NetAppAccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := NetAppAccountId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateNetAppAccountID checks that 'input' can be parsed as a Net App Account ID +func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseNetAppAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Net App Account ID +func (id NetAppAccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Net App Account ID +func (id NetAppAccountId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + } +} + +// String returns a human-readable description of this Net App Account ID +func (id NetAppAccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_snapshotpolicies.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_snapshotpolicies.go new file mode 100644 index 000000000000..f0662d3bf339 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/id_snapshotpolicies.go @@ -0,0 +1,137 @@ +package snapshotpolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SnapshotPoliciesId{} + +// SnapshotPoliciesId is a struct representing the Resource ID for a Snapshot Policies +type SnapshotPoliciesId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + SnapshotPolicyName string +} + +// NewSnapshotPoliciesID returns a new SnapshotPoliciesId struct +func NewSnapshotPoliciesID(subscriptionId string, resourceGroupName string, accountName string, snapshotPolicyName string) SnapshotPoliciesId { + return SnapshotPoliciesId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + SnapshotPolicyName: snapshotPolicyName, + } +} + +// ParseSnapshotPoliciesID parses 'input' into a SnapshotPoliciesId +func ParseSnapshotPoliciesID(input string) (*SnapshotPoliciesId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotPoliciesId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotPoliciesId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSnapshotPoliciesIDInsensitively parses 'input' case-insensitively into a SnapshotPoliciesId +// note: this method should only be used for API response data and not user input +func ParseSnapshotPoliciesIDInsensitively(input string) (*SnapshotPoliciesId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotPoliciesId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotPoliciesId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.SnapshotPolicyName, ok = parsed.Parsed["snapshotPolicyName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotPolicyName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSnapshotPoliciesID checks that 'input' can be parsed as a Snapshot Policies ID +func ValidateSnapshotPoliciesID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSnapshotPoliciesID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Snapshot Policies ID +func (id SnapshotPoliciesId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.SnapshotPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policies ID +func (id SnapshotPoliciesId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), + resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), + } +} + +// String returns a human-readable description of this Snapshot Policies ID +func (id SnapshotPoliciesId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Snapshot Policy Name: %q", id.SnapshotPolicyName), + } + return fmt.Sprintf("Snapshot Policies (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciescreate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciescreate_autorest.go new file mode 100644 index 000000000000..43d25be8b167 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciescreate_autorest.go @@ -0,0 +1,68 @@ +package snapshotpolicy + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesCreateOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotPolicy +} + +// SnapshotPoliciesCreate ... +func (c SnapshotPolicyClient) SnapshotPoliciesCreate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicy) (result SnapshotPoliciesCreateOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesCreate", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesCreate", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSnapshotPoliciesCreate(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesCreate", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSnapshotPoliciesCreate prepares the SnapshotPoliciesCreate request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesCreate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicy) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSnapshotPoliciesCreate handles the response to the SnapshotPoliciesCreate request. The method always +// closes the http.Response Body. +func (c SnapshotPolicyClient) responderForSnapshotPoliciesCreate(resp *http.Response) (result SnapshotPoliciesCreateOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesdelete_autorest.go new file mode 100644 index 000000000000..0b2ba8905215 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesdelete_autorest.go @@ -0,0 +1,78 @@ +package snapshotpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SnapshotPoliciesDelete ... +func (c SnapshotPolicyClient) SnapshotPoliciesDelete(ctx context.Context, id SnapshotPoliciesId) (result SnapshotPoliciesDeleteOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForSnapshotPoliciesDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SnapshotPoliciesDeleteThenPoll performs SnapshotPoliciesDelete then polls until it's completed +func (c SnapshotPolicyClient) SnapshotPoliciesDeleteThenPoll(ctx context.Context, id SnapshotPoliciesId) error { + result, err := c.SnapshotPoliciesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing SnapshotPoliciesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SnapshotPoliciesDelete: %+v", err) + } + + return nil +} + +// preparerForSnapshotPoliciesDelete prepares the SnapshotPoliciesDelete request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesDelete(ctx context.Context, id SnapshotPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSnapshotPoliciesDelete sends the SnapshotPoliciesDelete request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotPolicyClient) senderForSnapshotPoliciesDelete(ctx context.Context, req *http.Request) (future SnapshotPoliciesDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesget_autorest.go new file mode 100644 index 000000000000..26d3741d8b6c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesget_autorest.go @@ -0,0 +1,67 @@ +package snapshotpolicy + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesGetOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotPolicy +} + +// SnapshotPoliciesGet ... +func (c SnapshotPolicyClient) SnapshotPoliciesGet(ctx context.Context, id SnapshotPoliciesId) (result SnapshotPoliciesGetOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSnapshotPoliciesGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSnapshotPoliciesGet prepares the SnapshotPoliciesGet request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesGet(ctx context.Context, id SnapshotPoliciesId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSnapshotPoliciesGet handles the response to the SnapshotPoliciesGet request. The method always +// closes the http.Response Body. +func (c SnapshotPolicyClient) responderForSnapshotPoliciesGet(resp *http.Response) (result SnapshotPoliciesGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpolicieslist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpolicieslist_autorest.go new file mode 100644 index 000000000000..b9f36c35c96f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpolicieslist_autorest.go @@ -0,0 +1,68 @@ +package snapshotpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesListOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotPoliciesList +} + +// SnapshotPoliciesList ... +func (c SnapshotPolicyClient) SnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (result SnapshotPoliciesListOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForSnapshotPoliciesList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesList", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForSnapshotPoliciesList prepares the SnapshotPoliciesList request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/snapshotPolicies", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForSnapshotPoliciesList handles the response to the SnapshotPoliciesList request. The method always +// closes the http.Response Body. +func (c SnapshotPolicyClient) responderForSnapshotPoliciesList(resp *http.Response) (result SnapshotPoliciesListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesupdate_autorest.go new file mode 100644 index 000000000000..eea75a1378c0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/method_snapshotpoliciesupdate_autorest.go @@ -0,0 +1,79 @@ +package snapshotpolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// SnapshotPoliciesUpdate ... +func (c SnapshotPolicyClient) SnapshotPoliciesUpdate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicyPatch) (result SnapshotPoliciesUpdateOperationResponse, err error) { + req, err := c.preparerForSnapshotPoliciesUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForSnapshotPoliciesUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshotpolicy.SnapshotPolicyClient", "SnapshotPoliciesUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// SnapshotPoliciesUpdateThenPoll performs SnapshotPoliciesUpdate then polls until it's completed +func (c SnapshotPolicyClient) SnapshotPoliciesUpdateThenPoll(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicyPatch) error { + result, err := c.SnapshotPoliciesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing SnapshotPoliciesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after SnapshotPoliciesUpdate: %+v", err) + } + + return nil +} + +// preparerForSnapshotPoliciesUpdate prepares the SnapshotPoliciesUpdate request. +func (c SnapshotPolicyClient) preparerForSnapshotPoliciesUpdate(ctx context.Context, id SnapshotPoliciesId, input SnapshotPolicyPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForSnapshotPoliciesUpdate sends the SnapshotPoliciesUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotPolicyClient) senderForSnapshotPoliciesUpdate(ctx context.Context, req *http.Request) (future SnapshotPoliciesUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_dailyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_dailyschedule.go new file mode 100644 index 000000000000..bdafb72e6e09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_dailyschedule.go @@ -0,0 +1,11 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DailySchedule struct { + Hour *int64 `json:"hour,omitempty"` + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_hourlyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_hourlyschedule.go new file mode 100644 index 000000000000..a1e5d0fa0283 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_hourlyschedule.go @@ -0,0 +1,10 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HourlySchedule struct { + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_monthlyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_monthlyschedule.go new file mode 100644 index 000000000000..02cbcad6a592 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_monthlyschedule.go @@ -0,0 +1,12 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MonthlySchedule struct { + DaysOfMonth *string `json:"daysOfMonth,omitempty"` + Hour *int64 `json:"hour,omitempty"` + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicieslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicieslist.go new file mode 100644 index 000000000000..910e2519adbe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicieslist.go @@ -0,0 +1,8 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPoliciesList struct { + Value *[]SnapshotPolicy `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicy.go new file mode 100644 index 000000000000..310cfaaf1bb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicy.go @@ -0,0 +1,19 @@ +package snapshotpolicy + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicy struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties SnapshotPolicyProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicypatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicypatch.go new file mode 100644 index 000000000000..76df9be172b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicypatch.go @@ -0,0 +1,13 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicyPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *SnapshotPolicyProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicyproperties.go new file mode 100644 index 000000000000..fb4fb0fcb05a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_snapshotpolicyproperties.go @@ -0,0 +1,13 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotPolicyProperties struct { + DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` + MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_weeklyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_weeklyschedule.go new file mode 100644 index 000000000000..128ece7ef5ef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/model_weeklyschedule.go @@ -0,0 +1,12 @@ +package snapshotpolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WeeklySchedule struct { + Day *string `json:"day,omitempty"` + Hour *int64 `json:"hour,omitempty"` + Minute *int64 `json:"minute,omitempty"` + SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` + UsedBytes *int64 `json:"usedBytes,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/version.go new file mode 100644 index 000000000000..00061163a3a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy/version.go @@ -0,0 +1,12 @@ +package snapshotpolicy + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicy/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/README.md new file mode 100644 index 000000000000..e6d357e24b68 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/README.md @@ -0,0 +1,111 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots` Documentation + +The `snapshots` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots" +``` + + +### Client Initialization + +```go +client := snapshots.NewSnapshotsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SnapshotsClient.Create` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +payload := snapshots.Snapshot{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotsClient.Delete` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotsClient.Get` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotsClient.List` + +```go +ctx := context.TODO() +id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +read, err := client.List(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SnapshotsClient.RestoreFiles` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") + +payload := snapshots.SnapshotRestoreFiles{ + // ... +} + + +if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `SnapshotsClient.Update` + +```go +ctx := context.TODO() +id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue", "snapshotValue") +var payload interface{} + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/client.go new file mode 100644 index 000000000000..62d2a1323835 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/client.go @@ -0,0 +1,18 @@ +package snapshots + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotsClient struct { + Client autorest.Client + baseUri string +} + +func NewSnapshotsClientWithBaseURI(endpoint string) SnapshotsClient { + return SnapshotsClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_snapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_snapshot.go new file mode 100644 index 000000000000..d38fb8cb8f01 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_snapshot.go @@ -0,0 +1,163 @@ +package snapshots + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = SnapshotId{} + +// SnapshotId is a struct representing the Resource ID for a Snapshot +type SnapshotId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string + SnapshotName string +} + +// NewSnapshotID returns a new SnapshotId struct +func NewSnapshotID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string, snapshotName string) SnapshotId { + return SnapshotId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + SnapshotName: snapshotName, + } +} + +// ParseSnapshotID parses 'input' into a SnapshotId +func ParseSnapshotID(input string) (*SnapshotId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseSnapshotIDInsensitively parses 'input' case-insensitively into a SnapshotId +// note: this method should only be used for API response data and not user input +func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { + parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := SnapshotId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + if id.SnapshotName, ok = parsed.Parsed["snapshotName"]; !ok { + return nil, fmt.Errorf("the segment 'snapshotName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID +func ValidateSnapshotID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseSnapshotID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Snapshot ID +func (id SnapshotId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName, id.SnapshotName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Snapshot ID +func (id SnapshotId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), + resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), + } +} + +// String returns a human-readable description of this Snapshot ID +func (id SnapshotId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), + } + return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_volume.go new file mode 100644 index 000000000000..c5cc73e141c7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/id_volume.go @@ -0,0 +1,150 @@ +package snapshots + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + } +} + +// ParseVolumeID parses 'input' into a VolumeId +func ParseVolumeID(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVolumeIDInsensitively parses 'input' case-insensitively into a VolumeId +// note: this method should only be used for API response data and not user input +func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVolumeID checks that 'input' can be parsed as a Volume ID +func ValidateVolumeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVolumeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Volume ID +func (id VolumeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Volume ID +func (id VolumeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + } +} + +// String returns a human-readable description of this Volume ID +func (id VolumeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + } + return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_create_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_create_autorest.go new file mode 100644 index 000000000000..90b33471adef --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_create_autorest.go @@ -0,0 +1,79 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Create ... +func (c SnapshotsClient) Create(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOperationResponse, err error) { + req, err := c.preparerForCreate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Create", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Create", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c SnapshotsClient) CreateThenPoll(ctx context.Context, id SnapshotId, input Snapshot) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} + +// preparerForCreate prepares the Create request. +func (c SnapshotsClient) preparerForCreate(ctx context.Context, id SnapshotId, input Snapshot) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreate sends the Create request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForCreate(ctx context.Context, req *http.Request) (future CreateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_delete_autorest.go new file mode 100644 index 000000000000..55f7d9d07967 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_delete_autorest.go @@ -0,0 +1,78 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Delete ... +func (c SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c SnapshotsClient) DeleteThenPoll(ctx context.Context, id SnapshotId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c SnapshotsClient) preparerForDelete(ctx context.Context, id SnapshotId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_get_autorest.go new file mode 100644 index 000000000000..4764bf6f0606 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_get_autorest.go @@ -0,0 +1,67 @@ +package snapshots + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Snapshot +} + +// Get ... +func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c SnapshotsClient) preparerForGet(ctx context.Context, id SnapshotId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c SnapshotsClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_list_autorest.go new file mode 100644 index 000000000000..5d2f714bdc1f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_list_autorest.go @@ -0,0 +1,68 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *SnapshotsList +} + +// List ... +func (c SnapshotsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForList prepares the List request. +func (c SnapshotsClient) preparerForList(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/snapshots", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c SnapshotsClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_restorefiles_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_restorefiles_autorest.go new file mode 100644 index 000000000000..18ef248aa733 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_restorefiles_autorest.go @@ -0,0 +1,79 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestoreFilesOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// RestoreFiles ... +func (c SnapshotsClient) RestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (result RestoreFilesOperationResponse, err error) { + req, err := c.preparerForRestoreFiles(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "RestoreFiles", nil, "Failure preparing request") + return + } + + result, err = c.senderForRestoreFiles(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "RestoreFiles", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed +func (c SnapshotsClient) RestoreFilesThenPoll(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) error { + result, err := c.RestoreFiles(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RestoreFiles: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after RestoreFiles: %+v", err) + } + + return nil +} + +// preparerForRestoreFiles prepares the RestoreFiles request. +func (c SnapshotsClient) preparerForRestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/restoreFiles", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForRestoreFiles sends the RestoreFiles request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForRestoreFiles(ctx context.Context, req *http.Request) (future RestoreFilesOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_update_autorest.go new file mode 100644 index 000000000000..f96261c20b0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/method_update_autorest.go @@ -0,0 +1,79 @@ +package snapshots + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c SnapshotsClient) Update(ctx context.Context, id SnapshotId, input interface{}) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "snapshots.SnapshotsClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c SnapshotsClient) UpdateThenPoll(ctx context.Context, id SnapshotId, input interface{}) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c SnapshotsClient) preparerForUpdate(ctx context.Context, id SnapshotId, input interface{}) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c SnapshotsClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshot.go new file mode 100644 index 000000000000..996c7160dd19 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshot.go @@ -0,0 +1,12 @@ +package snapshots + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Snapshot struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SnapshotProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotproperties.go new file mode 100644 index 000000000000..fe60537eaaa9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotproperties.go @@ -0,0 +1,28 @@ +package snapshots + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotProperties struct { + Created *string `json:"created,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SnapshotId *string `json:"snapshotId,omitempty"` +} + +func (o *SnapshotProperties) GetCreatedAsTime() (*time.Time, error) { + if o.Created == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") +} + +func (o *SnapshotProperties) SetCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Created = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotrestorefiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotrestorefiles.go new file mode 100644 index 000000000000..de80d971dcf6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotrestorefiles.go @@ -0,0 +1,9 @@ +package snapshots + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotRestoreFiles struct { + DestinationPath *string `json:"destinationPath,omitempty"` + FilePaths []string `json:"filePaths"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotslist.go new file mode 100644 index 000000000000..bf283b0d2ac6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/model_snapshotslist.go @@ -0,0 +1,8 @@ +package snapshots + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SnapshotsList struct { + Value *[]Snapshot `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/version.go new file mode 100644 index 000000000000..90179a6f56ae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots/version.go @@ -0,0 +1,12 @@ +package snapshots + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/snapshots/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/README.md new file mode 100644 index 000000000000..c42f7262724b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes` Documentation + +The `volumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes" +``` + + +### Client Initialization + +```go +client := volumes.NewVolumesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VolumesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumes.Volume{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesClient.Delete` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesClient.Get` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +read, err := client.Get(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VolumesClient.List` + +```go +ctx := context.TODO() +id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue") + +// alternatively `client.List(ctx, id)` can be used to do batched pagination +items, err := client.ListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VolumesClient.Update` + +```go +ctx := context.TODO() +id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumes.VolumePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/client.go new file mode 100644 index 000000000000..d0a40573bf00 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/client.go @@ -0,0 +1,18 @@ +package volumes + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesClient struct { + Client autorest.Client + baseUri string +} + +func NewVolumesClientWithBaseURI(endpoint string) VolumesClient { + return VolumesClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/constants.go new file mode 100644 index 000000000000..4c9bed0d63be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/constants.go @@ -0,0 +1,270 @@ +package volumes + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvsDataStore string + +const ( + AvsDataStoreDisabled AvsDataStore = "Disabled" + AvsDataStoreEnabled AvsDataStore = "Enabled" +) + +func PossibleValuesForAvsDataStore() []string { + return []string{ + string(AvsDataStoreDisabled), + string(AvsDataStoreEnabled), + } +} + +func parseAvsDataStore(input string) (*AvsDataStore, error) { + vals := map[string]AvsDataStore{ + "disabled": AvsDataStoreDisabled, + "enabled": AvsDataStoreEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AvsDataStore(input) + return &out, nil +} + +type ChownMode string + +const ( + ChownModeRestricted ChownMode = "Restricted" + ChownModeUnrestricted ChownMode = "Unrestricted" +) + +func PossibleValuesForChownMode() []string { + return []string{ + string(ChownModeRestricted), + string(ChownModeUnrestricted), + } +} + +func parseChownMode(input string) (*ChownMode, error) { + vals := map[string]ChownMode{ + "restricted": ChownModeRestricted, + "unrestricted": ChownModeUnrestricted, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ChownMode(input) + return &out, nil +} + +type EnableSubvolumes string + +const ( + EnableSubvolumesDisabled EnableSubvolumes = "Disabled" + EnableSubvolumesEnabled EnableSubvolumes = "Enabled" +) + +func PossibleValuesForEnableSubvolumes() []string { + return []string{ + string(EnableSubvolumesDisabled), + string(EnableSubvolumesEnabled), + } +} + +func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { + vals := map[string]EnableSubvolumes{ + "disabled": EnableSubvolumesDisabled, + "enabled": EnableSubvolumesEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EnableSubvolumes(input) + return &out, nil +} + +type EndpointType string + +const ( + EndpointTypeDst EndpointType = "dst" + EndpointTypeSrc EndpointType = "src" +) + +func PossibleValuesForEndpointType() []string { + return []string{ + string(EndpointTypeDst), + string(EndpointTypeSrc), + } +} + +func parseEndpointType(input string) (*EndpointType, error) { + vals := map[string]EndpointType{ + "dst": EndpointTypeDst, + "src": EndpointTypeSrc, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := EndpointType(input) + return &out, nil +} + +type NetworkFeatures string + +const ( + NetworkFeaturesBasic NetworkFeatures = "Basic" + NetworkFeaturesStandard NetworkFeatures = "Standard" +) + +func PossibleValuesForNetworkFeatures() []string { + return []string{ + string(NetworkFeaturesBasic), + string(NetworkFeaturesStandard), + } +} + +func parseNetworkFeatures(input string) (*NetworkFeatures, error) { + vals := map[string]NetworkFeatures{ + "basic": NetworkFeaturesBasic, + "standard": NetworkFeaturesStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkFeatures(input) + return &out, nil +} + +type ReplicationSchedule string + +const ( + ReplicationScheduleDaily ReplicationSchedule = "daily" + ReplicationScheduleHourly ReplicationSchedule = "hourly" + ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" +) + +func PossibleValuesForReplicationSchedule() []string { + return []string{ + string(ReplicationScheduleDaily), + string(ReplicationScheduleHourly), + string(ReplicationScheduleOneZerominutely), + } +} + +func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { + vals := map[string]ReplicationSchedule{ + "daily": ReplicationScheduleDaily, + "hourly": ReplicationScheduleHourly, + "_10minutely": ReplicationScheduleOneZerominutely, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ReplicationSchedule(input) + return &out, nil +} + +type SecurityStyle string + +const ( + SecurityStyleNtfs SecurityStyle = "ntfs" + SecurityStyleUnix SecurityStyle = "unix" +) + +func PossibleValuesForSecurityStyle() []string { + return []string{ + string(SecurityStyleNtfs), + string(SecurityStyleUnix), + } +} + +func parseSecurityStyle(input string) (*SecurityStyle, error) { + vals := map[string]SecurityStyle{ + "ntfs": SecurityStyleNtfs, + "unix": SecurityStyleUnix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityStyle(input) + return &out, nil +} + +type ServiceLevel string + +const ( + ServiceLevelPremium ServiceLevel = "Premium" + ServiceLevelStandard ServiceLevel = "Standard" + ServiceLevelStandardZRS ServiceLevel = "StandardZRS" + ServiceLevelUltra ServiceLevel = "Ultra" +) + +func PossibleValuesForServiceLevel() []string { + return []string{ + string(ServiceLevelPremium), + string(ServiceLevelStandard), + string(ServiceLevelStandardZRS), + string(ServiceLevelUltra), + } +} + +func parseServiceLevel(input string) (*ServiceLevel, error) { + vals := map[string]ServiceLevel{ + "premium": ServiceLevelPremium, + "standard": ServiceLevelStandard, + "standardzrs": ServiceLevelStandardZRS, + "ultra": ServiceLevelUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ServiceLevel(input) + return &out, nil +} + +type VolumeStorageToNetworkProximity string + +const ( + VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" + VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" + VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" +) + +func PossibleValuesForVolumeStorageToNetworkProximity() []string { + return []string{ + string(VolumeStorageToNetworkProximityDefault), + string(VolumeStorageToNetworkProximityTOne), + string(VolumeStorageToNetworkProximityTTwo), + } +} + +func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { + vals := map[string]VolumeStorageToNetworkProximity{ + "default": VolumeStorageToNetworkProximityDefault, + "t1": VolumeStorageToNetworkProximityTOne, + "t2": VolumeStorageToNetworkProximityTTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VolumeStorageToNetworkProximity(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_capacitypool.go new file mode 100644 index 000000000000..06f8b4531bd9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_capacitypool.go @@ -0,0 +1,137 @@ +package volumes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = CapacityPoolId{} + +// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool +type CapacityPoolId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string +} + +// NewCapacityPoolID returns a new CapacityPoolId struct +func NewCapacityPoolID(subscriptionId string, resourceGroupName string, accountName string, poolName string) CapacityPoolId { + return CapacityPoolId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + } +} + +// ParseCapacityPoolID parses 'input' into a CapacityPoolId +func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId +// note: this method should only be used for API response data and not user input +func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { + parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CapacityPoolId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID +func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseCapacityPoolID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Pool ID +func (id CapacityPoolId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID +func (id CapacityPoolId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + } +} + +// String returns a human-readable description of this Capacity Pool ID +func (id CapacityPoolId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + } + return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_volume.go new file mode 100644 index 000000000000..d4e93b387a44 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/id_volume.go @@ -0,0 +1,150 @@ +package volumes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + } +} + +// ParseVolumeID parses 'input' into a VolumeId +func ParseVolumeID(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVolumeIDInsensitively parses 'input' case-insensitively into a VolumeId +// note: this method should only be used for API response data and not user input +func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVolumeID checks that 'input' can be parsed as a Volume ID +func ValidateVolumeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVolumeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Volume ID +func (id VolumeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Volume ID +func (id VolumeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + } +} + +// String returns a human-readable description of this Volume ID +func (id VolumeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + } + return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_createorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_createorupdate_autorest.go new file mode 100644 index 000000000000..ae61c0fe91ec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_createorupdate_autorest.go @@ -0,0 +1,79 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// CreateOrUpdate ... +func (c VolumesClient) CreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (result CreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "CreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "CreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c VolumesClient) CreateOrUpdateThenPoll(ctx context.Context, id VolumeId, input Volume) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForCreateOrUpdate prepares the CreateOrUpdate request. +func (c VolumesClient) preparerForCreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForCreateOrUpdate sends the CreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesClient) senderForCreateOrUpdate(ctx context.Context, req *http.Request) (future CreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_delete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_delete_autorest.go new file mode 100644 index 000000000000..1b97fdf87abf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_delete_autorest.go @@ -0,0 +1,107 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +type DeleteOperationOptions struct { + ForceDelete *bool +} + +func DefaultDeleteOperationOptions() DeleteOperationOptions { + return DeleteOperationOptions{} +} + +func (o DeleteOperationOptions) toHeaders() map[string]interface{} { + out := make(map[string]interface{}) + + return out +} + +func (o DeleteOperationOptions) toQueryString() map[string]interface{} { + out := make(map[string]interface{}) + + if o.ForceDelete != nil { + out["forceDelete"] = *o.ForceDelete + } + + return out +} + +// Delete ... +func (c VolumesClient) Delete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + req, err := c.preparerForDelete(ctx, id, options) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Delete", nil, "Failure preparing request") + return + } + + result, err = c.senderForDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Delete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VolumesClient) DeleteThenPoll(ctx context.Context, id VolumeId, options DeleteOperationOptions) error { + result, err := c.Delete(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} + +// preparerForDelete prepares the Delete request. +func (c VolumesClient) preparerForDelete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + for k, v := range options.toQueryString() { + queryParameters[k] = autorest.Encode("query", v) + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithHeaders(options.toHeaders()), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForDelete sends the Delete request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesClient) senderForDelete(ctx context.Context, req *http.Request) (future DeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_get_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_get_autorest.go new file mode 100644 index 000000000000..f35ab8d36ba5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_get_autorest.go @@ -0,0 +1,67 @@ +package volumes + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetOperationResponse struct { + HttpResponse *http.Response + Model *Volume +} + +// Get ... +func (c VolumesClient) Get(ctx context.Context, id VolumeId) (result GetOperationResponse, err error) { + req, err := c.preparerForGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Get", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Get", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Get", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForGet prepares the Get request. +func (c VolumesClient) preparerForGet(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForGet handles the response to the Get request. The method always +// closes the http.Response Body. +func (c VolumesClient) responderForGet(resp *http.Response) (result GetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_list_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_list_autorest.go new file mode 100644 index 000000000000..40c311905e59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_list_autorest.go @@ -0,0 +1,186 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListOperationResponse struct { + HttpResponse *http.Response + Model *[]Volume + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (ListOperationResponse, error) +} + +type ListCompleteResult struct { + Items []Volume +} + +func (r ListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r ListOperationResponse) LoadMore(ctx context.Context) (resp ListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// List ... +func (c VolumesClient) List(ctx context.Context, id CapacityPoolId) (resp ListOperationResponse, err error) { + req, err := c.preparerForList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// ListComplete retrieves all of the results into a single object +func (c VolumesClient) ListComplete(ctx context.Context, id CapacityPoolId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VolumeOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c VolumesClient) ListCompleteMatchingPredicate(ctx context.Context, id CapacityPoolId, predicate VolumeOperationPredicate) (resp ListCompleteResult, err error) { + items := make([]Volume, 0) + + page, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := ListCompleteResult{ + Items: items, + } + return out, nil +} + +// preparerForList prepares the List request. +func (c VolumesClient) preparerForList(ctx context.Context, id CapacityPoolId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/volumes", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForListWithNextLink prepares the List request with the given nextLink token. +func (c VolumesClient) preparerForListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForList handles the response to the List request. The method always +// closes the http.Response Body. +func (c VolumesClient) responderForList(resp *http.Response) (result ListOperationResponse, err error) { + type page struct { + Values []Volume `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result ListOperationResponse, err error) { + req, err := c.preparerForListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "List", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_update_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_update_autorest.go new file mode 100644 index 000000000000..7e6872e1513e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/method_update_autorest.go @@ -0,0 +1,79 @@ +package volumes + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// Update ... +func (c VolumesClient) Update(ctx context.Context, id VolumeId, input VolumePatch) (result UpdateOperationResponse, err error) { + req, err := c.preparerForUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Update", nil, "Failure preparing request") + return + } + + result, err = c.senderForUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumes.VolumesClient", "Update", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c VolumesClient) UpdateThenPoll(ctx context.Context, id VolumeId, input VolumePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} + +// preparerForUpdate prepares the Update request. +func (c VolumesClient) preparerForUpdate(ctx context.Context, id VolumeId, input VolumePatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForUpdate sends the Update request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesClient) senderForUpdate(ctx context.Context, req *http.Request) (future UpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_exportpolicyrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_exportpolicyrule.go new file mode 100644 index 000000000000..9b059c747578 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_exportpolicyrule.go @@ -0,0 +1,22 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExportPolicyRule struct { + AllowedClients *string `json:"allowedClients,omitempty"` + ChownMode *ChownMode `json:"chownMode,omitempty"` + Cifs *bool `json:"cifs,omitempty"` + HasRootAccess *bool `json:"hasRootAccess,omitempty"` + Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` + Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` + Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` + Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` + Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` + Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` + Nfsv3 *bool `json:"nfsv3,omitempty"` + Nfsv41 *bool `json:"nfsv41,omitempty"` + RuleIndex *int64 `json:"ruleIndex,omitempty"` + UnixReadOnly *bool `json:"unixReadOnly,omitempty"` + UnixReadWrite *bool `json:"unixReadWrite,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_mounttargetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_mounttargetproperties.go new file mode 100644 index 000000000000..b92b9edb4154 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_mounttargetproperties.go @@ -0,0 +1,11 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MountTargetProperties struct { + FileSystemId string `json:"fileSystemId"` + IpAddress *string `json:"ipAddress,omitempty"` + MountTargetId *string `json:"mountTargetId,omitempty"` + SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_placementkeyvaluepairs.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_placementkeyvaluepairs.go new file mode 100644 index 000000000000..588e9729c1e4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_placementkeyvaluepairs.go @@ -0,0 +1,9 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PlacementKeyValuePairs struct { + Key string `json:"key"` + Value string `json:"value"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_replicationobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_replicationobject.go new file mode 100644 index 000000000000..b7d6873811e2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_replicationobject.go @@ -0,0 +1,12 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicationObject struct { + EndpointType *EndpointType `json:"endpointType,omitempty"` + RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` + RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` + ReplicationId *string `json:"replicationId,omitempty"` + ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volume.go new file mode 100644 index 000000000000..f92955c95e93 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volume.go @@ -0,0 +1,19 @@ +package volumes + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Volume struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VolumeProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumebackupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumebackupproperties.go new file mode 100644 index 000000000000..1de25f15e330 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumebackupproperties.go @@ -0,0 +1,11 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeBackupProperties struct { + BackupEnabled *bool `json:"backupEnabled,omitempty"` + BackupPolicyId *string `json:"backupPolicyId,omitempty"` + PolicyEnforced *bool `json:"policyEnforced,omitempty"` + VaultId *string `json:"vaultId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatch.go new file mode 100644 index 000000000000..b39ea01aee89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatch.go @@ -0,0 +1,13 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VolumePatchProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchproperties.go new file mode 100644 index 000000000000..ed4479ca252b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchproperties.go @@ -0,0 +1,16 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatchProperties struct { + DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + UnixPermissions *string `json:"unixPermissions,omitempty"` + UsageThreshold *int64 `json:"usageThreshold,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesdataprotection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesdataprotection.go new file mode 100644 index 000000000000..8c9edc10ff72 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesdataprotection.go @@ -0,0 +1,9 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatchPropertiesDataProtection struct { + Backup *VolumeBackupProperties `json:"backup,omitempty"` + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesexportpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesexportpolicy.go new file mode 100644 index 000000000000..ae83a5fc1b4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepatchpropertiesexportpolicy.go @@ -0,0 +1,8 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePatchPropertiesExportPolicy struct { + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumeproperties.go new file mode 100644 index 000000000000..6ae23e00b8da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumeproperties.go @@ -0,0 +1,49 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeProperties struct { + AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` + BackupId *string `json:"backupId,omitempty"` + BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` + CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` + CloneProgress *int64 `json:"cloneProgress,omitempty"` + CoolAccess *bool `json:"coolAccess,omitempty"` + CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` + CreationToken string `json:"creationToken"` + DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` + DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` + DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` + EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` + EncryptionKeySource *string `json:"encryptionKeySource,omitempty"` + ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` + FileSystemId *string `json:"fileSystemId,omitempty"` + IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + IsRestoring *bool `json:"isRestoring,omitempty"` + KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` + LdapEnabled *bool `json:"ldapEnabled,omitempty"` + MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` + MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` + NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` + NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` + PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` + ProtocolTypes *[]string `json:"protocolTypes,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` + SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` + ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` + SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` + SmbEncryption *bool `json:"smbEncryption,omitempty"` + SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` + SnapshotId *string `json:"snapshotId,omitempty"` + StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` + SubnetId string `json:"subnetId"` + T2Network *string `json:"t2Network,omitempty"` + ThroughputMibps *float64 `json:"throughputMibps,omitempty"` + UnixPermissions *string `json:"unixPermissions,omitempty"` + UsageThreshold int64 `json:"usageThreshold"` + VolumeGroupName *string `json:"volumeGroupName,omitempty"` + VolumeSpecName *string `json:"volumeSpecName,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesdataprotection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesdataprotection.go new file mode 100644 index 000000000000..28163c70a51c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesdataprotection.go @@ -0,0 +1,10 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePropertiesDataProtection struct { + Backup *VolumeBackupProperties `json:"backup,omitempty"` + Replication *ReplicationObject `json:"replication,omitempty"` + Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesexportpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesexportpolicy.go new file mode 100644 index 000000000000..fda5f4739dee --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumepropertiesexportpolicy.go @@ -0,0 +1,8 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumePropertiesExportPolicy struct { + Rules *[]ExportPolicyRule `json:"rules,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumesnapshotproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumesnapshotproperties.go new file mode 100644 index 000000000000..48aba2acce0d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/model_volumesnapshotproperties.go @@ -0,0 +1,8 @@ +package volumes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeSnapshotProperties struct { + SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/predicates.go new file mode 100644 index 000000000000..536d6a70dc81 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/predicates.go @@ -0,0 +1,34 @@ +package volumes + +type VolumeOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VolumeOperationPredicate) Matches(input Volume) bool { + + if p.Etag != nil && (input.Etag == nil && *p.Etag != *input.Etag) { + return false + } + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/version.go new file mode 100644 index 000000000000..55ac8a54fde6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes/version.go @@ -0,0 +1,12 @@ +package volumes + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/volumes/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/README.md new file mode 100644 index 000000000000..037bd15af1bb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/README.md @@ -0,0 +1,106 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication` Documentation + +The `volumesreplication` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2021-10-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication" +``` + + +### Client Initialization + +```go +client := volumesreplication.NewVolumesReplicationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VolumesReplicationClient.VolumesAuthorizeReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumesreplication.AuthorizeRequest{ + // ... +} + + +if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesBreakReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +payload := volumesreplication.BreakReplicationRequest{ + // ... +} + + +if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesDeleteReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesReInitializeReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesReplicationStatus` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +read, err := client.VolumesReplicationStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VolumesReplicationClient.VolumesResyncReplication` + +```go +ctx := context.TODO() +id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountValue", "poolValue", "volumeValue") + +if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/client.go new file mode 100644 index 000000000000..64a4d559d37e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/client.go @@ -0,0 +1,18 @@ +package volumesreplication + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesReplicationClient struct { + Client autorest.Client + baseUri string +} + +func NewVolumesReplicationClientWithBaseURI(endpoint string) VolumesReplicationClient { + return VolumesReplicationClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/constants.go new file mode 100644 index 000000000000..6b67c17d5884 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/constants.go @@ -0,0 +1,65 @@ +package volumesreplication + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MirrorState string + +const ( + MirrorStateBroken MirrorState = "Broken" + MirrorStateMirrored MirrorState = "Mirrored" + MirrorStateUninitialized MirrorState = "Uninitialized" +) + +func PossibleValuesForMirrorState() []string { + return []string{ + string(MirrorStateBroken), + string(MirrorStateMirrored), + string(MirrorStateUninitialized), + } +} + +func parseMirrorState(input string) (*MirrorState, error) { + vals := map[string]MirrorState{ + "broken": MirrorStateBroken, + "mirrored": MirrorStateMirrored, + "uninitialized": MirrorStateUninitialized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MirrorState(input) + return &out, nil +} + +type RelationshipStatus string + +const ( + RelationshipStatusIdle RelationshipStatus = "Idle" + RelationshipStatusTransferring RelationshipStatus = "Transferring" +) + +func PossibleValuesForRelationshipStatus() []string { + return []string{ + string(RelationshipStatusIdle), + string(RelationshipStatusTransferring), + } +} + +func parseRelationshipStatus(input string) (*RelationshipStatus, error) { + vals := map[string]RelationshipStatus{ + "idle": RelationshipStatusIdle, + "transferring": RelationshipStatusTransferring, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RelationshipStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/id_volume.go new file mode 100644 index 000000000000..c88adaf98587 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/id_volume.go @@ -0,0 +1,150 @@ +package volumesreplication + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, accountName string, poolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PoolName: poolName, + VolumeName: volumeName, + } +} + +// ParseVolumeID parses 'input' into a VolumeId +func ParseVolumeID(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseVolumeIDInsensitively parses 'input' case-insensitively into a VolumeId +// note: this method should only be used for API response data and not user input +func ParseVolumeIDInsensitively(input string) (*VolumeId, error) { + parser := resourceids.NewParserFromResourceIdType(VolumeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VolumeId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, fmt.Errorf("the segment 'subscriptionId' was not found in the resource id %q", input) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, fmt.Errorf("the segment 'resourceGroupName' was not found in the resource id %q", input) + } + + if id.AccountName, ok = parsed.Parsed["accountName"]; !ok { + return nil, fmt.Errorf("the segment 'accountName' was not found in the resource id %q", input) + } + + if id.PoolName, ok = parsed.Parsed["poolName"]; !ok { + return nil, fmt.Errorf("the segment 'poolName' was not found in the resource id %q", input) + } + + if id.VolumeName, ok = parsed.Parsed["volumeName"]; !ok { + return nil, fmt.Errorf("the segment 'volumeName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateVolumeID checks that 'input' can be parsed as a Volume ID +func ValidateVolumeID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseVolumeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Volume ID +func (id VolumeId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PoolName, id.VolumeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Volume ID +func (id VolumeId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), + resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), + resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), + resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), + resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), + resourceids.UserSpecifiedSegment("accountName", "accountValue"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("poolName", "poolValue"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), + } +} + +// String returns a human-readable description of this Volume ID +func (id VolumeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Pool Name: %q", id.PoolName), + fmt.Sprintf("Volume Name: %q", id.VolumeName), + } + return fmt.Sprintf("Volume (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesauthorizereplication_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesauthorizereplication_autorest.go new file mode 100644 index 000000000000..76b9f035e73f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesauthorizereplication_autorest.go @@ -0,0 +1,79 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesAuthorizeReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesAuthorizeReplication ... +func (c VolumesReplicationClient) VolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (result VolumesAuthorizeReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesAuthorizeReplication(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesAuthorizeReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesAuthorizeReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesAuthorizeReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesAuthorizeReplicationThenPoll performs VolumesAuthorizeReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesAuthorizeReplicationThenPoll(ctx context.Context, id VolumeId, input AuthorizeRequest) error { + result, err := c.VolumesAuthorizeReplication(ctx, id, input) + if err != nil { + return fmt.Errorf("performing VolumesAuthorizeReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesAuthorizeReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesAuthorizeReplication prepares the VolumesAuthorizeReplication request. +func (c VolumesReplicationClient) preparerForVolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/authorizeReplication", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesAuthorizeReplication sends the VolumesAuthorizeReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesAuthorizeReplication(ctx context.Context, req *http.Request) (future VolumesAuthorizeReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesbreakreplication_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesbreakreplication_autorest.go new file mode 100644 index 000000000000..2d1739198e38 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesbreakreplication_autorest.go @@ -0,0 +1,79 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesBreakReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesBreakReplication ... +func (c VolumesReplicationClient) VolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (result VolumesBreakReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesBreakReplication(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesBreakReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesBreakReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesBreakReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesBreakReplicationThenPoll performs VolumesBreakReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesBreakReplicationThenPoll(ctx context.Context, id VolumeId, input BreakReplicationRequest) error { + result, err := c.VolumesBreakReplication(ctx, id, input) + if err != nil { + return fmt.Errorf("performing VolumesBreakReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesBreakReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesBreakReplication prepares the VolumesBreakReplication request. +func (c VolumesReplicationClient) preparerForVolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/breakReplication", id.ID())), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesBreakReplication sends the VolumesBreakReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesBreakReplication(ctx context.Context, req *http.Request) (future VolumesBreakReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesdeletereplication_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesdeletereplication_autorest.go new file mode 100644 index 000000000000..6dd32453b2de --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesdeletereplication_autorest.go @@ -0,0 +1,78 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesDeleteReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesDeleteReplication ... +func (c VolumesReplicationClient) VolumesDeleteReplication(ctx context.Context, id VolumeId) (result VolumesDeleteReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesDeleteReplication(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesDeleteReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesDeleteReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesDeleteReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesDeleteReplicationThenPoll performs VolumesDeleteReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesDeleteReplicationThenPoll(ctx context.Context, id VolumeId) error { + result, err := c.VolumesDeleteReplication(ctx, id) + if err != nil { + return fmt.Errorf("performing VolumesDeleteReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesDeleteReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesDeleteReplication prepares the VolumesDeleteReplication request. +func (c VolumesReplicationClient) preparerForVolumesDeleteReplication(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/deleteReplication", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesDeleteReplication sends the VolumesDeleteReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesDeleteReplication(ctx context.Context, req *http.Request) (future VolumesDeleteReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreinitializereplication_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreinitializereplication_autorest.go new file mode 100644 index 000000000000..f894605753fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreinitializereplication_autorest.go @@ -0,0 +1,78 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesReInitializeReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesReInitializeReplication ... +func (c VolumesReplicationClient) VolumesReInitializeReplication(ctx context.Context, id VolumeId) (result VolumesReInitializeReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesReInitializeReplication(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReInitializeReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesReInitializeReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReInitializeReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesReInitializeReplicationThenPoll performs VolumesReInitializeReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesReInitializeReplicationThenPoll(ctx context.Context, id VolumeId) error { + result, err := c.VolumesReInitializeReplication(ctx, id) + if err != nil { + return fmt.Errorf("performing VolumesReInitializeReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesReInitializeReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesReInitializeReplication prepares the VolumesReInitializeReplication request. +func (c VolumesReplicationClient) preparerForVolumesReInitializeReplication(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/reinitializeReplication", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesReInitializeReplication sends the VolumesReInitializeReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesReInitializeReplication(ctx context.Context, req *http.Request) (future VolumesReInitializeReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreplicationstatus_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreplicationstatus_autorest.go new file mode 100644 index 000000000000..12b0382b0cd4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesreplicationstatus_autorest.go @@ -0,0 +1,68 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesReplicationStatusOperationResponse struct { + HttpResponse *http.Response + Model *ReplicationStatus +} + +// VolumesReplicationStatus ... +func (c VolumesReplicationClient) VolumesReplicationStatus(ctx context.Context, id VolumeId) (result VolumesReplicationStatusOperationResponse, err error) { + req, err := c.preparerForVolumesReplicationStatus(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReplicationStatus", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReplicationStatus", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForVolumesReplicationStatus(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesReplicationStatus", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForVolumesReplicationStatus prepares the VolumesReplicationStatus request. +func (c VolumesReplicationClient) preparerForVolumesReplicationStatus(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/replicationStatus", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForVolumesReplicationStatus handles the response to the VolumesReplicationStatus request. The method always +// closes the http.Response Body. +func (c VolumesReplicationClient) responderForVolumesReplicationStatus(resp *http.Response) (result VolumesReplicationStatusOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesresyncreplication_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesresyncreplication_autorest.go new file mode 100644 index 000000000000..05f303966fa5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/method_volumesresyncreplication_autorest.go @@ -0,0 +1,78 @@ +package volumesreplication + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumesResyncReplicationOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// VolumesResyncReplication ... +func (c VolumesReplicationClient) VolumesResyncReplication(ctx context.Context, id VolumeId) (result VolumesResyncReplicationOperationResponse, err error) { + req, err := c.preparerForVolumesResyncReplication(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesResyncReplication", nil, "Failure preparing request") + return + } + + result, err = c.senderForVolumesResyncReplication(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "volumesreplication.VolumesReplicationClient", "VolumesResyncReplication", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// VolumesResyncReplicationThenPoll performs VolumesResyncReplication then polls until it's completed +func (c VolumesReplicationClient) VolumesResyncReplicationThenPoll(ctx context.Context, id VolumeId) error { + result, err := c.VolumesResyncReplication(ctx, id) + if err != nil { + return fmt.Errorf("performing VolumesResyncReplication: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after VolumesResyncReplication: %+v", err) + } + + return nil +} + +// preparerForVolumesResyncReplication prepares the VolumesResyncReplication request. +func (c VolumesReplicationClient) preparerForVolumesResyncReplication(ctx context.Context, id VolumeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/resyncReplication", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForVolumesResyncReplication sends the VolumesResyncReplication request. The method will close the +// http.Response Body if it receives an error. +func (c VolumesReplicationClient) senderForVolumesResyncReplication(ctx context.Context, req *http.Request) (future VolumesResyncReplicationOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_authorizerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_authorizerequest.go new file mode 100644 index 000000000000..ff1cefa31efa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_authorizerequest.go @@ -0,0 +1,8 @@ +package volumesreplication + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthorizeRequest struct { + RemoteVolumeResourceId *string `json:"remoteVolumeResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_breakreplicationrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_breakreplicationrequest.go new file mode 100644 index 000000000000..b6a0a179a9c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_breakreplicationrequest.go @@ -0,0 +1,8 @@ +package volumesreplication + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BreakReplicationRequest struct { + ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_replicationstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_replicationstatus.go new file mode 100644 index 000000000000..2a79dddf7a40 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/model_replicationstatus.go @@ -0,0 +1,12 @@ +package volumesreplication + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ReplicationStatus struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + Healthy *bool `json:"healthy,omitempty"` + MirrorState *MirrorState `json:"mirrorState,omitempty"` + RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` + TotalProgress *string `json:"totalProgress,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/version.go new file mode 100644 index 000000000000..5a6266022a22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication/version.go @@ -0,0 +1,12 @@ +package volumesreplication + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-10-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/volumesreplication/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 0b17d05cda2d..355d431fa26d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -46,7 +46,6 @@ github.com/Azure/azure-sdk-for-go/services/mediaservices/mgmt/2021-05-01/media github.com/Azure/azure-sdk-for-go/services/monitor/mgmt/2020-10-01/insights github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2020-01-01/mysql github.com/Azure/azure-sdk-for-go/services/mysql/mgmt/2021-05-01/mysqlflexibleservers -github.com/Azure/azure-sdk-for-go/services/netapp/mgmt/2021-10-01/netapp github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-08-01/network github.com/Azure/azure-sdk-for-go/services/operationalinsights/mgmt/2020-08-01/operationalinsights github.com/Azure/azure-sdk-for-go/services/postgresql/mgmt/2020-01-01/postgresql @@ -241,6 +240,12 @@ github.com/hashicorp/go-azure-sdk/resource-manager/managedidentity/2018-11-30/ma github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/accounts github.com/hashicorp/go-azure-sdk/resource-manager/maps/2021-02-01/creators github.com/hashicorp/go-azure-sdk/resource-manager/mixedreality/2021-01-01/resource +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/capacitypools +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/netappaccounts +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshotpolicy +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/snapshots +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumes +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2021-10-01/volumesreplication github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/namespaces github.com/hashicorp/go-azure-sdk/resource-manager/notificationhubs/2017-04-01/notificationhubs github.com/hashicorp/go-azure-sdk/resource-manager/portal/2019-01-01-preview/dashboard