diff --git a/examples/netapp/nfsv3_volume_with_backup_policy/README.md b/examples/netapp/nfsv3_volume_with_backup_policy/README.md new file mode 100644 index 000000000000..c49e1248d227 --- /dev/null +++ b/examples/netapp/nfsv3_volume_with_backup_policy/README.md @@ -0,0 +1,5 @@ +## Example: Azure NetApp Files Volume with Backup Policy enabled + +This example shows how to create an Azure NetApp volume with Backup policy enabled. + +For more information, please refer to [Understand Azure NetApp Files backup](https://learn.microsoft.com/en-us/azure/azure-netapp-files/backup-introduction). diff --git a/examples/netapp/nfsv3_volume_with_backup_policy/main.tf b/examples/netapp/nfsv3_volume_with_backup_policy/main.tf new file mode 100755 index 000000000000..f4d131286a0e --- /dev/null +++ b/examples/netapp/nfsv3_volume_with_backup_policy/main.tf @@ -0,0 +1,100 @@ +provider "azurerm" { + features { + netapp { + prevent_volume_destruction = false + delete_backups_on_backup_vault_destroy = true + } + } +} + +resource "azurerm_resource_group" "example" { + name = "${var.prefix}-resources" + location = var.location +} + +resource "azurerm_virtual_network" "example" { + name = "${var.prefix}-virtualnetwork" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + address_space = ["10.0.0.0/16"] +} + +resource "azurerm_subnet" "example" { + name = "${var.prefix}-subnet" + resource_group_name = azurerm_resource_group.example.name + virtual_network_name = azurerm_virtual_network.example.name + address_prefixes = ["10.0.2.0/24"] + + delegation { + name = "testdelegation" + + service_delegation { + name = "Microsoft.Netapp/volumes" + actions = ["Microsoft.Network/networkinterfaces/*", "Microsoft.Network/virtualNetworks/subnets/join/action"] + } + } +} + +resource "azurerm_netapp_account" "example" { + name = "${var.prefix}-netappaccount" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_netapp_backup_vault" "example" { + name = "${var.prefix}-netappbackupvault" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_name = azurerm_netapp_account.example.name +} + +resource "azurerm_netapp_backup_policy" "example" { + name = "${var.prefix}-netappbackuppolicy" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_name = azurerm_netapp_account.example.name + daily_backups_to_keep = 2 + weekly_backups_to_keep = 2 + monthly_backups_to_keep = 2 + enabled = true +} + +resource "azurerm_netapp_pool" "example" { + name = "${var.prefix}-netapppool" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + account_name = azurerm_netapp_account.example.name + service_level = "Standard" + size_in_tb = 4 +} + +resource "azurerm_netapp_volume" "example" { + lifecycle { + prevent_destroy = true + } + + name = "${var.prefix}-netappvolume" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + account_name = azurerm_netapp_account.example.name + pool_name = azurerm_netapp_pool.example.name + volume_path = "${var.prefix}-netappvolume" + service_level = "Standard" + protocols = ["NFSv3"] + network_features = "Basic" + subnet_id = azurerm_subnet.example.id + storage_quota_in_gb = 100 + + data_protection_backup_policy { + backup_vault_id = azurerm_netapp_backup_vault.example.id + backup_policy_id = azurerm_netapp_backup_policy.example.id + policy_enabled = true + } + + export_policy_rule { + rule_index = 1 + allowed_clients = ["0.0.0.0/0"] + protocols_enabled = ["NFSv3"] + unix_read_write = true + } +} diff --git a/examples/netapp/nfsv3_volume_with_backup_policy/variables.tf b/examples/netapp/nfsv3_volume_with_backup_policy/variables.tf new file mode 100755 index 000000000000..fe8ca460af61 --- /dev/null +++ b/examples/netapp/nfsv3_volume_with_backup_policy/variables.tf @@ -0,0 +1,7 @@ +variable "location" { + description = "The Azure location where all resources in this example should be created." +} + +variable "prefix" { + description = "The prefix used for all resources used by this example" +} diff --git a/internal/features/defaults.go b/internal/features/defaults.go index 182016f29801..183ac1b3d379 100644 --- a/internal/features/defaults.go +++ b/internal/features/defaults.go @@ -78,5 +78,9 @@ func Default() UserFeatures { VMBackupStopProtectionAndRetainDataOnDestroy: false, PurgeProtectedItemsFromVaultOnDestroy: false, }, + NetApp: NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: false, + PreventVolumeDestruction: true, + }, } } diff --git a/internal/features/user_flags.go b/internal/features/user_flags.go index 181f423fcc15..53d1351ea2b7 100644 --- a/internal/features/user_flags.go +++ b/internal/features/user_flags.go @@ -21,6 +21,7 @@ type UserFeatures struct { PostgresqlFlexibleServer PostgresqlFlexibleServerFeatures MachineLearning MachineLearningFeatures RecoveryService RecoveryServiceFeatures + NetApp NetAppFeatures } type CognitiveAccountFeatures struct { @@ -109,3 +110,8 @@ type RecoveryServiceFeatures struct { VMBackupStopProtectionAndRetainDataOnDestroy bool PurgeProtectedItemsFromVaultOnDestroy bool } + +type NetAppFeatures struct { + DeleteBackupsOnBackupVaultDestroy bool + PreventVolumeDestruction bool +} diff --git a/internal/provider/features.go b/internal/provider/features.go index e39c3ce0c741..0becb67ac8db 100644 --- a/internal/provider/features.go +++ b/internal/provider/features.go @@ -387,6 +387,28 @@ func schemaFeatures(supportLegacyTestSuite bool) *pluginsdk.Schema { }, }, }, + + "netapp": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "delete_backups_on_backup_vault_destroy": { + Description: "When enabled, backups will be deleted when the `azurerm_netapp_backup_vault` resource is destroyed", + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "prevent_volume_destruction": { + Description: "When enabled, the volume will not be destroyed, safeguarding from severe data loss", + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + }, + }, + }, + }, } // this is a temporary hack to enable us to gradually add provider blocks to test configurations @@ -648,5 +670,18 @@ func expandFeatures(input []interface{}) features.UserFeatures { } } + if raw, ok := val["netapp"]; ok { + items := raw.([]interface{}) + if len(items) > 0 { + netappRaw := items[0].(map[string]interface{}) + if v, ok := netappRaw["delete_backups_on_backup_vault_destroy"]; ok { + featuresMap.NetApp.DeleteBackupsOnBackupVaultDestroy = v.(bool) + } + if v, ok := netappRaw["prevent_volume_destruction"]; ok { + featuresMap.NetApp.PreventVolumeDestruction = v.(bool) + } + } + } + return featuresMap } diff --git a/internal/provider/features_test.go b/internal/provider/features_test.go index 81cfe4b6ade8..e9191a67aa0a 100644 --- a/internal/provider/features_test.go +++ b/internal/provider/features_test.go @@ -91,6 +91,10 @@ func TestExpandFeatures(t *testing.T) { VMBackupStopProtectionAndRetainDataOnDestroy: false, PurgeProtectedItemsFromVaultOnDestroy: false, }, + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: false, + PreventVolumeDestruction: true, + }, }, }, { @@ -201,6 +205,12 @@ func TestExpandFeatures(t *testing.T) { "purge_protected_items_from_vault_on_destroy": true, }, }, + "netapp": []interface{}{ + map[string]interface{}{ + "delete_backups_on_backup_vault_destroy": true, + "prevent_volume_destruction": true, + }, + }, }, }, Expected: features.UserFeatures{ @@ -274,6 +284,10 @@ func TestExpandFeatures(t *testing.T) { VMBackupStopProtectionAndRetainDataOnDestroy: true, PurgeProtectedItemsFromVaultOnDestroy: true, }, + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: true, + PreventVolumeDestruction: true, + }, }, }, { @@ -384,6 +398,12 @@ func TestExpandFeatures(t *testing.T) { "purge_protected_items_from_vault_on_destroy": false, }, }, + "netapp": []interface{}{ + map[string]interface{}{ + "delete_backups_on_backup_vault_destroy": false, + "prevent_volume_destruction": false, + }, + }, }, }, Expected: features.UserFeatures{ @@ -457,6 +477,10 @@ func TestExpandFeatures(t *testing.T) { VMBackupStopProtectionAndRetainDataOnDestroy: false, PurgeProtectedItemsFromVaultOnDestroy: false, }, + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: false, + PreventVolumeDestruction: false, + }, }, }, } @@ -1745,3 +1769,92 @@ func TestExpandFeaturesRecoveryService(t *testing.T) { } } } + +func TestExpandFeaturesNetApp(t *testing.T) { + testData := []struct { + Name string + Input []interface{} + EnvVars map[string]interface{} + Expected features.UserFeatures + }{ + { + Name: "Empty Block", + Input: []interface{}{ + map[string]interface{}{ + "netapp": []interface{}{}, + }, + }, + Expected: features.UserFeatures{ + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: false, + PreventVolumeDestruction: true, + }, + }, + }, + { + Name: "NetApp Features Enabled", + Input: []interface{}{ + map[string]interface{}{ + "netapp": []interface{}{ + map[string]interface{}{ + "delete_backups_on_backup_vault_destroy": true, + "prevent_volume_destruction": true, + }, + }, + }, + }, + Expected: features.UserFeatures{ + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: false, + PreventVolumeDestruction: true, + }, + }, + }, + { + Name: "NetApp Features Disabled", + Input: []interface{}{ + map[string]interface{}{ + "netapp": []interface{}{ + map[string]interface{}{ + "delete_backups_on_backup_vault_destroy": false, + "prevent_volume_destruction": false, + }, + }, + }, + }, + Expected: features.UserFeatures{ + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: false, + PreventVolumeDestruction: false, + }, + }, + }, + { + Name: "NetApp Features Reverse Default Values", + Input: []interface{}{ + map[string]interface{}{ + "netapp": []interface{}{ + map[string]interface{}{ + "delete_backups_on_backup_vault_destroy": true, + "prevent_volume_destruction": false, + }, + }, + }, + }, + Expected: features.UserFeatures{ + NetApp: features.NetAppFeatures{ + DeleteBackupsOnBackupVaultDestroy: true, + PreventVolumeDestruction: false, + }, + }, + }, + } + + for _, testCase := range testData { + t.Logf("[DEBUG] Test Case: %q", testCase.Name) + result := expandFeatures(testCase.Input) + if !reflect.DeepEqual(result.Subscription, testCase.Expected.Subscription) { + t.Fatalf("Expected %+v but got %+v", result.Subscription, testCase.Expected.Subscription) + } + } +} diff --git a/internal/provider/framework/config.go b/internal/provider/framework/config.go index c34676741127..e15a877224be 100644 --- a/internal/provider/framework/config.go +++ b/internal/provider/framework/config.go @@ -481,6 +481,28 @@ func (p *ProviderConfig) Load(ctx context.Context, data *ProviderModel, tfVersio f.RecoveryService.VMBackupStopProtectionAndRetainDataOnDestroy = false f.RecoveryService.PurgeProtectedItemsFromVaultOnDestroy = false } + + if !features.NetApp.IsNull() && !features.NetApp.IsUnknown() { + var feature []NetApp + d := features.NetApp.ElementsAs(ctx, &feature, true) + diags.Append(d...) + if diags.HasError() { + return + } + + f.NetApp.DeleteBackupsOnBackupVaultDestroy = false + if !feature[0].DeleteBackupsOnBackupVaultDestroy.IsNull() && !feature[0].DeleteBackupsOnBackupVaultDestroy.IsUnknown() { + f.NetApp.DeleteBackupsOnBackupVaultDestroy = feature[0].DeleteBackupsOnBackupVaultDestroy.ValueBool() + } + + f.NetApp.PreventVolumeDestruction = true + if !feature[0].PreventVolumeDestruction.IsNull() && !feature[0].PreventVolumeDestruction.IsUnknown() { + f.NetApp.PreventVolumeDestruction = feature[0].PreventVolumeDestruction.ValueBool() + } + } else { + f.NetApp.DeleteBackupsOnBackupVaultDestroy = false + f.NetApp.PreventVolumeDestruction = true + } } p.clientBuilder.Features = f diff --git a/internal/provider/framework/config_test.go b/internal/provider/framework/config_test.go index 485420b0a392..6f2fab30ccd8 100644 --- a/internal/provider/framework/config_test.go +++ b/internal/provider/framework/config_test.go @@ -200,6 +200,18 @@ func TestProviderConfig_LoadDefault(t *testing.T) { if features.RecoveryService.PurgeProtectedItemsFromVaultOnDestroy { t.Errorf("expected recovery_service.PurgeProtectedItemsFromVaultOnDestroy to be false") } + + if features.RecoveryService.PurgeProtectedItemsFromVaultOnDestroy { + t.Errorf("expected recovery_service.PurgeProtectedItemsFromVaultOnDestroy to be false") + } + + if features.NetApp.DeleteBackupsOnBackupVaultDestroy { + t.Errorf("expected netapp.DeleteBackupsOnBackupVaultDestroy to be false") + } + + if !features.NetApp.PreventVolumeDestruction { + t.Errorf("expected netapp.PreventVolumeDestruction to be true") + } } // TODO - helper functions to make setting up test date more easily so we can add more configuration coverage @@ -307,6 +319,12 @@ func defaultFeaturesList() types.List { }) recoveryServicesVaultsList, _ := basetypes.NewListValue(types.ObjectType{}.WithAttributeTypes(RecoveryServiceVaultsAttributes), []attr.Value{recoveryServicesVaults}) + netapp, _ := basetypes.NewObjectValueFrom(context.Background(), NetAppAttributes, map[string]attr.Value{ + "delete_backups_on_backup_vault_destroy": basetypes.NewBoolNull(), + "prevent_volume_destruction": basetypes.NewBoolNull(), + }) + netappList, _ := basetypes.NewListValue(types.ObjectType{}.WithAttributeTypes(NetAppAttributes), []attr.Value{netapp}) + fData, d := basetypes.NewObjectValue(FeaturesAttributes, map[string]attr.Value{ "api_management": apiManagementList, "app_configuration": appConfigurationList, @@ -325,6 +343,7 @@ func defaultFeaturesList() types.List { "machine_learning": machineLearningList, "recovery_service": recoveryServicesList, "recovery_services_vaults": recoveryServicesVaultsList, + "netapp": netappList, }) fmt.Printf("%+v", d) diff --git a/internal/provider/framework/model.go b/internal/provider/framework/model.go index 84388a4b5d57..082edef187c8 100644 --- a/internal/provider/framework/model.go +++ b/internal/provider/framework/model.go @@ -58,6 +58,7 @@ type Features struct { MachineLearning types.List `tfsdk:"machine_learning"` RecoveryService types.List `tfsdk:"recovery_service"` RecoveryServicesVaults types.List `tfsdk:"recovery_services_vaults"` + NetApp types.List `tfsdk:"netapp"` } // FeaturesAttributes and the other block attribute vars are required for unit testing on the Load func @@ -80,6 +81,7 @@ var FeaturesAttributes = map[string]attr.Type{ "machine_learning": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(MachineLearningAttributes)), "recovery_service": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(RecoveryServiceAttributes)), "recovery_services_vaults": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(RecoveryServiceVaultsAttributes)), + "netapp": types.ListType{}.WithElementType(types.ObjectType{}.WithAttributeTypes(NetAppAttributes)), } type APIManagement struct { @@ -255,3 +257,13 @@ type RecoveryServiceVaults struct { var RecoveryServiceVaultsAttributes = map[string]attr.Type{ "recover_soft_deleted_backup_protected_vm": types.BoolType, } + +type NetApp struct { + DeleteBackupsOnBackupVaultDestroy types.Bool `tfsdk:"delete_backups_on_backup_vault_destroy"` + PreventVolumeDestruction types.Bool `tfsdk:"prevent_volume_destruction"` +} + +var NetAppAttributes = map[string]attr.Type{ + "delete_backups_on_backup_vault_destroy": types.BoolType, + "prevent_volume_destruction": types.BoolType, +} diff --git a/internal/provider/framework/provider.go b/internal/provider/framework/provider.go index 1b59e7f187c4..50c49d8ec858 100644 --- a/internal/provider/framework/provider.go +++ b/internal/provider/framework/provider.go @@ -468,6 +468,20 @@ func (p *azureRmFrameworkProvider) Schema(_ context.Context, _ provider.SchemaRe }, }, }, + "netapp": schema.ListNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "delete_backups_on_backup_vault_destroy": schema.BoolAttribute{ + Optional: true, + Description: "When enabled, backups will be deleted when the `azurerm_netapp_backup_vault` resource is destroyed", + }, + "prevent_volume_destruction": schema.BoolAttribute{ + Description: "When enabled, the volume will not be destroyed, safeguarding from severe data loss", + Optional: true, + }, + }, + }, + }, }, }, }, diff --git a/internal/services/netapp/README.md b/internal/services/netapp/README.md new file mode 100644 index 000000000000..afdb8f6741bb --- /dev/null +++ b/internal/services/netapp/README.md @@ -0,0 +1,53 @@ +# This is a maintainer file for the Azure NetApp Files service. + +This document gives insights into who is maintaining this service and includes details for why certain decisions in this service package have been made. + +## Mainteiners + +- paulomarquesc +- orexii + +## Acceptance Tests + +- There is lack of SMB-related acceptance tests because it requires Active Directory Domain Controller infrastructure which is not easily automatable. SMB-related tests can only be tested if the infrastructure is setup beforehand which is not that trivial. We should not require SMB tests unless it comes with Domain Controller setup automation. Without automation, the SMB acceptance tests will fail and cause disruptions in CI/bulk testing. + +- New tests failing should not be accepted. + +## Polling functions + +- Some Netapp resources requires an extra type of polling mechanism. For example: + +```go +// Waiting for volume be completely provisioned +if err := waitForVolumeCreateOrUpdate(ctx, client, id); err != nil { + return err +} +``` + + This is because some operations return from regular SDK polling as completed but due to several factors it is still in progress (e.g. ARM caching, software and hardware layer sync delays, etc.). These wait functions are necessary and should not be removed. + +## Data loss prevention protection + +- Due to possibility of a volume to be deleted due to configuration changes on config file or changes made outside of Terraform, we have decided to not allow deletion of volumes by default. This is to prevent data loss. If you want to delete a volume, you need to set the feature block configuration `prevent_deletion_if_contains_resources` argument to `true`. + + In our tests we have added this block so the tests can delete the resources, but in production customers should not allow deletion of volumes by default. + +```hcl +features { + resource_group { + prevent_deletion_if_contains_resources = false + } +} +``` + +## Resource Group Deletion on Tests + +- A feature block configuration needs to be set to ensure tests conclude when Microsoft maintainers execute their testing. Due to some Microsoft subscription management policies, certain resources are created by default during the tests. This block allows the deletion of the resource group at the end of the tests. + +```hcl + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +``` diff --git a/internal/services/netapp/client/client.go b/internal/services/netapp/client/client.go index 2668c7a95a54..e1e4482fac20 100644 --- a/internal/services/netapp/client/client.go +++ b/internal/services/netapp/client/client.go @@ -6,14 +6,17 @@ package client import ( "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/internal/common" ) @@ -26,6 +29,9 @@ type Client struct { VolumeQuotaRules *volumequotarules.VolumeQuotaRulesClient SnapshotClient *snapshots.SnapshotsClient SnapshotPoliciesClient *snapshotpolicy.SnapshotPolicyClient + BackupVaultsClient *backupvaults.BackupVaultsClient + BackupPolicyClient *backuppolicy.BackupPolicyClient + BackupClient *backups.BackupsClient } func NewClient(o *common.ClientOptions) (*Client, error) { @@ -77,6 +83,24 @@ func NewClient(o *common.ClientOptions) (*Client, error) { return nil, fmt.Errorf("building SnapshotPoliciesClient client: %+v", err) } + backupVaultsClient, err := backupvaults.NewBackupVaultsClientWithBaseURI(o.Environment.ResourceManager) + o.Configure(backupVaultsClient.Client, o.Authorizers.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building BackupVaultsClient client: %+v", err) + } + + backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(o.Environment.ResourceManager) + o.Configure(backupPolicyClient.Client, o.Authorizers.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building BackupPoliciesClient client: %+v", err) + } + + backupClient, err := backups.NewBackupsClientWithBaseURI(o.Environment.ResourceManager) + o.Configure(backupClient.Client, o.Authorizers.ResourceManager) + if err != nil { + return nil, fmt.Errorf("building BackupClient client: %+v", err) + } + return &Client{ AccountClient: accountClient, PoolClient: poolClient, @@ -86,5 +110,8 @@ func NewClient(o *common.ClientOptions) (*Client, error) { VolumeQuotaRules: volumeQuotaRuleClient, SnapshotClient: snapshotClient, SnapshotPoliciesClient: snapshotPoliciesClient, + BackupVaultsClient: backupVaultsClient, + BackupPolicyClient: backupPolicyClient, + BackupClient: backupClient, }, nil } diff --git a/internal/services/netapp/models/models.go b/internal/services/netapp/models/models.go index 5e0924de1cbb..8637074b2efb 100644 --- a/internal/services/netapp/models/models.go +++ b/internal/services/netapp/models/models.go @@ -116,3 +116,23 @@ type NetAppVolumeQuotaRuleDataSourceModel struct { QuotaSizeInKiB int64 `tfschema:"quota_size_in_kib"` QuotaType string `tfschema:"quota_type"` } + +type NetAppBackupVaultModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + AccountName string `tfschema:"account_name"` + Tags map[string]string `tfschema:"tags"` +} + +type NetAppBackupPolicyModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + AccountName string `tfschema:"account_name"` + Tags map[string]string `tfschema:"tags"` + DailyBackupsToKeep int64 `tfschema:"daily_backups_to_keep"` + WeeklyBackupsToKeep int64 `tfschema:"weekly_backups_to_keep"` + MonthlyBackupsToKeep int64 `tfschema:"monthly_backups_to_keep"` + Enabled bool `tfschema:"enabled"` +} diff --git a/internal/services/netapp/netapp_account_data_source.go b/internal/services/netapp/netapp_account_data_source.go index 21a28d0dcc88..af4cd6adde89 100644 --- a/internal/services/netapp/netapp_account_data_source.go +++ b/internal/services/netapp/netapp_account_data_source.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/netapp/netapp_account_encryption_data_source.go b/internal/services/netapp/netapp_account_encryption_data_source.go index 74f72e5aa6d8..cee92f5df528 100644 --- a/internal/services/netapp/netapp_account_encryption_data_source.go +++ b/internal/services/netapp/netapp_account_encryption_data_source.go @@ -11,7 +11,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" @@ -36,40 +36,34 @@ func (r NetAppAccountEncryptionDataSource) IDValidationFunc() pluginsdk.SchemaVa func (r NetAppAccountEncryptionDataSource) Arguments() map[string]*pluginsdk.Schema { return map[string]*pluginsdk.Schema{ - "netapp_account_id": { Type: pluginsdk.TypeString, Required: true, Description: "The ID of the NetApp Account where encryption will be set.", ValidateFunc: netAppValidate.ValidateNetAppAccountID, }, + } +} +func (r NetAppAccountEncryptionDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ "user_assigned_identity_id": { - Type: pluginsdk.TypeString, - Optional: true, - Description: "The resource ID of the User Assigned Identity to use for encryption.", - ConflictsWith: []string{"system_assigned_identity_principal_id"}, + Type: pluginsdk.TypeString, + Computed: true, }, "system_assigned_identity_principal_id": { - Type: pluginsdk.TypeString, - Optional: true, - Description: "The Principal ID of the System Assigned Identity to use for encryption.", - ConflictsWith: []string{"user_assigned_identity_id"}, + Type: pluginsdk.TypeString, + Computed: true, }, "encryption_key": { - Type: pluginsdk.TypeString, - Optional: true, - Description: "The versionless encryption key url.", + Type: pluginsdk.TypeString, + Computed: true, }, } } -func (r NetAppAccountEncryptionDataSource) Attributes() map[string]*pluginsdk.Schema { - return map[string]*pluginsdk.Schema{} -} - func (r NetAppAccountEncryptionDataSource) Read() sdk.ResourceFunc { return sdk.ResourceFunc{ Timeout: 5 * time.Minute, @@ -78,7 +72,7 @@ func (r NetAppAccountEncryptionDataSource) Read() sdk.ResourceFunc { var state netAppModels.NetAppAccountEncryptionDataSourceModel if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } id, err := netappaccounts.ParseNetAppAccountID(state.NetAppAccountID) @@ -95,30 +89,41 @@ func (r NetAppAccountEncryptionDataSource) Read() sdk.ResourceFunc { } model := resp.Model - if model.Properties.Encryption == nil { - return fmt.Errorf("encryption information does not exist for %s", id) + if model == nil { + return fmt.Errorf("model is nil for %s", id) } - anfAccountIdentityFlattened, err := identity.FlattenLegacySystemAndUserAssignedMapToModel(model.Identity) - if err != nil { - return err - } - - state.EncryptionKey, err = flattenEncryption(model.Properties.Encryption) - if err != nil { - return err + if model.Properties == nil || model.Properties.Encryption == nil { + return fmt.Errorf("encryption information does not exist for %s", id) } - if len(anfAccountIdentityFlattened) > 0 { - if anfAccountIdentityFlattened[0].Type == identity.TypeSystemAssigned { - state.SystemAssignedIdentityPrincipalID = anfAccountIdentityFlattened[0].PrincipalId + if model.Identity != nil { + expanded, err := identity.FlattenLegacySystemAndUserAssignedMapToModel(model.Identity) + if err != nil { + return fmt.Errorf("flattening identity: %+v", err) } - if anfAccountIdentityFlattened[0].Type == identity.TypeUserAssigned { - if len(anfAccountIdentityFlattened[0].IdentityIds) > 0 { - state.UserAssignedIdentityID = anfAccountIdentityFlattened[0].IdentityIds[0] + for _, identityInfo := range expanded { + if identityInfo.Type == identity.TypeSystemAssigned { + if identityInfo.PrincipalId != "" { + state.SystemAssignedIdentityPrincipalID = identityInfo.PrincipalId + } } + + if identityInfo.Type == identity.TypeUserAssigned { + if len(identityInfo.IdentityIds) > 0 { + state.UserAssignedIdentityID = identityInfo.IdentityIds[0] + } + } + } + } + + if model.Properties.Encryption != nil { + encryptionKey, err := flattenEncryption(model.Properties.Encryption) + if err != nil { + return fmt.Errorf("flattening encryption: %+v", err) } + state.EncryptionKey = encryptionKey } metadata.SetID(id) diff --git a/internal/services/netapp/netapp_account_encryption_resource.go b/internal/services/netapp/netapp_account_encryption_resource.go index 5d44c949fc61..c860e9143648 100644 --- a/internal/services/netapp/netapp_account_encryption_resource.go +++ b/internal/services/netapp/netapp_account_encryption_resource.go @@ -6,14 +6,13 @@ package netapp import ( "context" "fmt" - "net/http" "time" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/locks" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" @@ -158,7 +157,7 @@ func (r NetAppAccountEncryptionResource) Update() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppAccountEncryption if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } metadata.Logger.Infof("Updating %s", id) @@ -178,8 +177,6 @@ func (r NetAppAccountEncryptionResource) Update() sdk.ResourceFunc { if err := client.AccountsUpdateThenPoll(ctx, pointer.From(id), update); err != nil { return fmt.Errorf("updating %s: %+v", id, err) } - - metadata.SetID(id) } return nil @@ -201,12 +198,12 @@ func (r NetAppAccountEncryptionResource) Read() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppAccountEncryption if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } existing, err := client.AccountsGet(ctx, pointer.From(id)) if err != nil { - if existing.HttpResponse.StatusCode == http.StatusNotFound { + if response.WasNotFound(existing.HttpResponse) { return metadata.MarkAsGone(id) } return fmt.Errorf("retrieving %s: %v", id, err) @@ -267,7 +264,7 @@ func (r NetAppAccountEncryptionResource) Delete() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppAccountEncryption if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } metadata.Logger.Infof("Updating %s", id) @@ -325,7 +322,7 @@ func expandEncryption(ctx context.Context, input string, keyVaultsClient *keyVau KeyVaultProperties: &netappaccounts.KeyVaultProperties{ KeyName: keyId.Name, KeyVaultUri: keyId.KeyVaultBaseUrl, - KeyVaultResourceId: parsedKeyVaultID.ID(), + KeyVaultResourceId: pointer.To(parsedKeyVaultID.ID()), }, } diff --git a/internal/services/netapp/netapp_account_encryption_resource_test.go b/internal/services/netapp/netapp_account_encryption_resource_test.go index 2e7012ea740a..0fa754abc395 100644 --- a/internal/services/netapp/netapp_account_encryption_resource_test.go +++ b/internal/services/netapp/netapp_account_encryption_resource_test.go @@ -10,7 +10,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" diff --git a/internal/services/netapp/netapp_account_resource.go b/internal/services/netapp/netapp_account_resource.go index fcd5105a7988..3ca2d3f1269e 100644 --- a/internal/services/netapp/netapp_account_resource.go +++ b/internal/services/netapp/netapp_account_resource.go @@ -15,7 +15,7 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" @@ -239,26 +239,22 @@ func resourceNetAppAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) er locks.ByID(id.ID()) defer locks.UnlockByID(id.ID()) - shouldUpdate := false update := netappaccounts.NetAppAccountPatch{ Properties: &netappaccounts.AccountProperties{}, } if d.HasChange("active_directory") { - shouldUpdate = true activeDirectoriesRaw := d.Get("active_directory").([]interface{}) activeDirectories := expandNetAppActiveDirectories(activeDirectoriesRaw) update.Properties.ActiveDirectories = activeDirectories } if d.HasChange("tags") { - shouldUpdate = true tagsRaw := d.Get("tags").(map[string]interface{}) update.Tags = tags.Expand(tagsRaw) } if d.HasChange("identity") { - shouldUpdate = true anfAccountIdentity, err := identity.ExpandLegacySystemAndUserAssignedMap(d.Get("identity").([]interface{})) if err != nil { return fmt.Errorf("expanding `identity`: %+v", err) @@ -267,10 +263,8 @@ func resourceNetAppAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) er update.Identity = anfAccountIdentity } - if shouldUpdate { - if err = client.AccountsUpdateThenPoll(ctx, *id, update); err != nil { - return fmt.Errorf("updating %s: %+v", id.ID(), err) - } + if err = client.AccountsUpdateThenPoll(ctx, *id, update); err != nil { + return fmt.Errorf("updating %s: %+v", id.ID(), err) } return resourceNetAppAccountRead(d, meta) diff --git a/internal/services/netapp/netapp_account_resource_test.go b/internal/services/netapp/netapp_account_resource_test.go index 444003b5c477..3e0a76d86c04 100644 --- a/internal/services/netapp/netapp_account_resource_test.go +++ b/internal/services/netapp/netapp_account_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" diff --git a/internal/services/netapp/netapp_backup_policy_data_source.go b/internal/services/netapp/netapp_backup_policy_data_source.go new file mode 100644 index 000000000000..d9d4928b44b5 --- /dev/null +++ b/internal/services/netapp/netapp_backup_policy_data_source.go @@ -0,0 +1,116 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "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/2024-03-01/backuppolicy" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type NetAppBackupPolicyDataSource struct{} + +var _ sdk.DataSource = NetAppBackupPolicyDataSource{} + +func (r NetAppBackupPolicyDataSource) ResourceType() string { + return "azurerm_netapp_backup_policy" +} + +func (r NetAppBackupPolicyDataSource) ModelObject() interface{} { + return &netAppModels.NetAppBackupVaultModel{} +} + +func (r NetAppBackupPolicyDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return backuppolicy.ValidateBackupPolicyID +} + +func (r NetAppBackupPolicyDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "account_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (r NetAppBackupPolicyDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "tags": commonschema.TagsDataSource(), + + "daily_backups_to_keep": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "weekly_backups_to_keep": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "monthly_backups_to_keep": { + Type: pluginsdk.TypeInt, + Computed: true, + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + } +} + +func (r NetAppBackupPolicyDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupPolicyClient + + var state netAppModels.NetAppBackupPolicyModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + backupPolicyID := backuppolicy.NewBackupPolicyID(metadata.Client.Account.SubscriptionId, state.ResourceGroupName, state.AccountName, state.Name) + + existing, err := client.BackupPoliciesGet(ctx, backupPolicyID) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found", backupPolicyID) + } + return fmt.Errorf("retrieving %s: %v", backupPolicyID, err) + } + + if model := existing.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = pointer.From(model.Tags) + state.DailyBackupsToKeep = pointer.From(model.Properties.DailyBackupsToKeep) + state.WeeklyBackupsToKeep = pointer.From(model.Properties.WeeklyBackupsToKeep) + state.MonthlyBackupsToKeep = pointer.From(model.Properties.MonthlyBackupsToKeep) + state.Enabled = pointer.From(model.Properties.Enabled) + } + + metadata.SetID(backupPolicyID) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/netapp/netapp_backup_policy_data_source_test.go b/internal/services/netapp/netapp_backup_policy_data_source_test.go new file mode 100644 index 000000000000..4f2e2e71ffc3 --- /dev/null +++ b/internal/services/netapp/netapp_backup_policy_data_source_test.go @@ -0,0 +1,40 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type NetAppBackupPolicyDataSource struct{} + +func TestAccNetAppBackupPolicyDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_netapp_backup_policy", "test") + d := NetAppBackupPolicyDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + ), + }, + }) +} + +func (d NetAppBackupPolicyDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_netapp_backup_policy" "test" { + resource_group_name = azurerm_resource_group.test.name + account_name = azurerm_netapp_account.test.name + name = azurerm_netapp_backup_policy.test.name +} +`, NetAppBackupPolicyResource{}.basic(data)) +} diff --git a/internal/services/netapp/netapp_backup_policy_resource.go b/internal/services/netapp/netapp_backup_policy_resource.go new file mode 100644 index 000000000000..3879a392464b --- /dev/null +++ b/internal/services/netapp/netapp_backup_policy_resource.go @@ -0,0 +1,309 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp + +import ( + "context" + "fmt" + "strconv" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "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/2024-03-01/backuppolicy" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" + netAppValidate "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/tf/validation" +) + +type NetAppBackupPolicyResource struct{} + +var _ sdk.Resource = NetAppBackupPolicyResource{} + +func (r NetAppBackupPolicyResource) ModelObject() interface{} { + return &netAppModels.NetAppBackupPolicyModel{} +} + +func (r NetAppBackupPolicyResource) ResourceType() string { + return "azurerm_netapp_backup_policy" +} + +func (r NetAppBackupPolicyResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return backuppolicy.ValidateBackupPolicyID +} + +func (r NetAppBackupPolicyResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: netAppValidate.VolumeQuotaRuleName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "account_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: netAppValidate.AccountName, + }, + + "tags": commonschema.Tags(), + + "daily_backups_to_keep": { + Type: pluginsdk.TypeInt, + Default: 2, + Optional: true, + ValidateFunc: validation.IntBetween(2, 1019), + }, + + "weekly_backups_to_keep": { + Type: pluginsdk.TypeInt, + Default: 1, + Optional: true, + ValidateFunc: validation.IntBetween(1, 1019), + }, + + "monthly_backups_to_keep": { + Type: pluginsdk.TypeInt, + Default: 1, + Optional: true, + ValidateFunc: validation.IntBetween(1, 1019), + }, + + "enabled": { + Type: pluginsdk.TypeBool, + Default: true, + Optional: true, + }, + } +} + +func (r NetAppBackupPolicyResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r NetAppBackupPolicyResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 90 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupPolicyClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var model netAppModels.NetAppBackupPolicyModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := backuppolicy.NewBackupPolicyID(subscriptionId, model.ResourceGroupName, model.AccountName, model.Name) + + // Validations + if errorList := netAppValidate.ValidateNetAppBackupPolicyCombinedRetention(model.DailyBackupsToKeep, model.WeeklyBackupsToKeep, model.MonthlyBackupsToKeep); len(errorList) > 0 { + return fmt.Errorf("one or more issues found while performing deeper validations for %s:\n%+v", id, errorList) + } + + metadata.Logger.Infof("Import check for %s", id) + existing, err := client.BackupPoliciesGet(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %s", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError(r.ResourceType(), id.ID()) + } + + parameters := backuppolicy.BackupPolicy{ + Location: location.Normalize(model.Location), + Tags: pointer.To(model.Tags), + Properties: backuppolicy.BackupPolicyProperties{ + DailyBackupsToKeep: pointer.To(model.DailyBackupsToKeep), + WeeklyBackupsToKeep: pointer.To(model.WeeklyBackupsToKeep), + MonthlyBackupsToKeep: pointer.To(model.MonthlyBackupsToKeep), + Enabled: pointer.To(model.Enabled), + }, + } + + err = client.BackupPoliciesCreateThenPoll(ctx, id, parameters) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r NetAppBackupPolicyResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 120 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupPolicyClient + + id, err := backuppolicy.ParseBackupPolicyID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Decoding state for %s", id) + var state netAppModels.NetAppBackupPolicyModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + update := backuppolicy.BackupPolicyPatch{ + Properties: &backuppolicy.BackupPolicyProperties{}, + } + + // Checking properties with changes + if metadata.ResourceData.HasChange("tags") { + update.Tags = pointer.To(state.Tags) + } + + if metadata.ResourceData.HasChange("daily_backups_to_keep") { + update.Properties.DailyBackupsToKeep = pointer.To(state.DailyBackupsToKeep) + } + + if metadata.ResourceData.HasChange("weekly_backups_to_keep") { + update.Properties.WeeklyBackupsToKeep = pointer.To(state.WeeklyBackupsToKeep) + } + + if metadata.ResourceData.HasChange("monthly_backups_to_keep") { + update.Properties.MonthlyBackupsToKeep = pointer.To(state.MonthlyBackupsToKeep) + } + + if metadata.ResourceData.HasChange("enabled") { + update.Properties.Enabled = pointer.To(state.Enabled) + } + + metadata.Logger.Infof("Updating %s", id) + + if err := client.BackupPoliciesUpdateThenPoll(ctx, pointer.From(id), update); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + return nil + }, + } +} + +func (r NetAppBackupPolicyResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupPolicyClient + + id, err := backuppolicy.ParseBackupPolicyID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Decoding state for %s", id) + var state netAppModels.NetAppBackupPolicyModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.BackupPoliciesGet(ctx, pointer.From(id)) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %v", id, err) + } + + state.AccountName = id.NetAppAccountName + state.Name = id.BackupPolicyName + state.ResourceGroupName = id.ResourceGroupName + + if model := existing.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = pointer.From(model.Tags) + state.DailyBackupsToKeep = pointer.From(model.Properties.DailyBackupsToKeep) + state.WeeklyBackupsToKeep = pointer.From(model.Properties.WeeklyBackupsToKeep) + state.MonthlyBackupsToKeep = pointer.From(model.Properties.MonthlyBackupsToKeep) + state.Enabled = pointer.From(model.Properties.Enabled) + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} + +func (r NetAppBackupPolicyResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 120 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupPolicyClient + + id, err := backuppolicy.ParseBackupPolicyID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err = client.BackupPoliciesDeleteThenPoll(ctx, pointer.From(id)); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + if err = waitForBackupPolicyDeletion(ctx, client, pointer.From(id)); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + return nil + }, + } +} + +func waitForBackupPolicyDeletion(ctx context.Context, client *backuppolicy.BackupPolicyClient, id backuppolicy.BackupPolicyId) error { + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") + } + stateConf := &pluginsdk.StateChangeConf{ + ContinuousTargetOccurence: 5, + Delay: 5 * time.Second, + MinTimeout: 5 * time.Second, + Pending: []string{"200", "202"}, + Target: []string{"204", "404"}, + Refresh: netappBackupPolicyStateRefreshFunc(ctx, client, id), + Timeout: time.Until(deadline), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be deleted: %+v", id, err) + } + + return nil +} + +func netappBackupPolicyStateRefreshFunc(ctx context.Context, client *backuppolicy.BackupPolicyClient, id backuppolicy.BackupPolicyId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.BackupPoliciesGet(ctx, id) + if err != nil { + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) + } + } + + statusCode := "dropped connection" + if res.HttpResponse != nil { + statusCode = strconv.Itoa(res.HttpResponse.StatusCode) + } + return res, statusCode, nil + } +} diff --git a/internal/services/netapp/netapp_backup_policy_test.go b/internal/services/netapp/netapp_backup_policy_test.go new file mode 100644 index 000000000000..768662c5a34d --- /dev/null +++ b/internal/services/netapp/netapp_backup_policy_test.go @@ -0,0 +1,184 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "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" +) + +type NetAppBackupPolicyResource struct{} + +func (t NetAppBackupPolicyResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { + id, err := backuppolicy.ParseBackupPolicyID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.NetApp.BackupPolicyClient.BackupPoliciesGet(ctx, *id) + if err != nil { + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + + return pointer.To(resp.Model != nil), nil +} + +func TestAccNetAppBackupPolicy_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_backup_policy", "test") + r := NetAppBackupPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccNetAppBackupPolicy_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_backup_policy", "test") + r := NetAppBackupPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccNetAppBackupPolicy_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_backup_policy", "test") + r := NetAppBackupPolicyResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + check.That(data.ResourceName).Key("daily_backups_to_keep").HasValue("2"), + check.That(data.ResourceName).Key("daily_backups_to_keep").HasValue("2"), + check.That(data.ResourceName).Key("daily_backups_to_keep").HasValue("2"), + check.That(data.ResourceName).Key("enabled").HasValue("true"), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + check.That(data.ResourceName).Key("daily_backups_to_keep").HasValue("10"), + check.That(data.ResourceName).Key("daily_backups_to_keep").HasValue("10"), + check.That(data.ResourceName).Key("daily_backups_to_keep").HasValue("10"), + check.That(data.ResourceName).Key("enabled").HasValue("false"), + ), + }, + data.ImportStep(), + }) +} + +func (r NetAppBackupPolicyResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_netapp_backup_policy" "test" { + name = "acctest-NetAppBackupPolicy-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name +} +`, r.template(data), data.RandomInteger) +} + +func (r NetAppBackupPolicyResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_netapp_backup_policy" "test" { + name = "acctest-NetAppBackupPolicy-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + daily_backups_to_keep = 2 + weekly_backups_to_keep = 2 + monthly_backups_to_keep = 2 + enabled = true + + tags = { + "testTag" = "testTagValue" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r NetAppBackupPolicyResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_netapp_backup_policy" "test" { + name = "acctest-NetAppBackupPolicy-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + daily_backups_to_keep = 10 + weekly_backups_to_keep = 10 + monthly_backups_to_keep = 10 + enabled = false + + tags = { + "testTag" = "testTagValue", + "FoO" = "BaR" + } +} +`, r.template(data), data.RandomInteger) +} + +func (NetAppBackupPolicyResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-netapp-%[1]d" + location = "%[2]s" + + tags = { + "SkipNRMSNSG" = "true" + } +} + +resource "azurerm_netapp_account" "test" { + name = "acctest-NetAppAccount-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + tags = { + "CreatedOnDate" = "2023-08-17T08:01:00Z", + "SkipASMAzSecPack" = "true" + } +} + +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/netapp/netapp_backup_vault_data_source.go b/internal/services/netapp/netapp_backup_vault_data_source.go new file mode 100644 index 000000000000..42721503d8fe --- /dev/null +++ b/internal/services/netapp/netapp_backup_vault_data_source.go @@ -0,0 +1,92 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "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/2024-03-01/backupvaults" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type NetAppBackupVaultDataSource struct{} + +var _ sdk.DataSource = NetAppBackupVaultDataSource{} + +func (r NetAppBackupVaultDataSource) ResourceType() string { + return "azurerm_netapp_backup_vault" +} + +func (r NetAppBackupVaultDataSource) ModelObject() interface{} { + return &netAppModels.NetAppBackupVaultModel{} +} + +func (r NetAppBackupVaultDataSource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return backupvaults.ValidateBackupVaultID +} + +func (r NetAppBackupVaultDataSource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "account_name": { + Type: pluginsdk.TypeString, + Required: true, + }, + } +} + +func (r NetAppBackupVaultDataSource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "location": commonschema.LocationComputed(), + + "tags": commonschema.TagsDataSource(), + } +} + +func (r NetAppBackupVaultDataSource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupVaultsClient + + var state netAppModels.NetAppBackupVaultModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + backupVaultID := backupvaults.NewBackupVaultID(metadata.Client.Account.SubscriptionId, state.ResourceGroupName, state.AccountName, state.Name) + + existing, err := client.Get(ctx, backupVaultID) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("%s was not found", backupVaultID) + } + return fmt.Errorf("retrieving %s: %v", backupVaultID, err) + } + + if model := existing.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = pointer.From(model.Tags) + } + + metadata.SetID(backupVaultID) + + return metadata.Encode(&state) + }, + } +} diff --git a/internal/services/netapp/netapp_backup_vault_data_source_test.go b/internal/services/netapp/netapp_backup_vault_data_source_test.go new file mode 100644 index 000000000000..9ba0d9d61cb3 --- /dev/null +++ b/internal/services/netapp/netapp_backup_vault_data_source_test.go @@ -0,0 +1,40 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" +) + +type NetAppBackupVaultDataSource struct{} + +func TestAccNetAppBackupVaultDataSource_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_netapp_backup_vault", "test") + d := NetAppBackupVaultDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: d.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("name").Exists(), + ), + }, + }) +} + +func (d NetAppBackupVaultDataSource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +data "azurerm_netapp_backup_vault" "test" { + resource_group_name = azurerm_resource_group.test.name + account_name = azurerm_netapp_account.test.name + name = azurerm_netapp_backup_vault.test.name +} +`, NetAppBackupVaultResource{}.basic(data)) +} diff --git a/internal/services/netapp/netapp_backup_vault_resource.go b/internal/services/netapp/netapp_backup_vault_resource.go new file mode 100644 index 000000000000..9f5062641946 --- /dev/null +++ b/internal/services/netapp/netapp_backup_vault_resource.go @@ -0,0 +1,376 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp + +import ( + "context" + "fmt" + "strconv" + "strings" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "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/2024-03-01/backups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults" + "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" + netAppValidate "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" +) + +type NetAppBackupVaultResource struct{} + +var _ sdk.Resource = NetAppBackupVaultResource{} + +func (r NetAppBackupVaultResource) ModelObject() interface{} { + return &netAppModels.NetAppBackupVaultModel{} +} + +func (r NetAppBackupVaultResource) ResourceType() string { + return "azurerm_netapp_backup_vault" +} + +func (r NetAppBackupVaultResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return backupvaults.ValidateBackupVaultID +} + +func (r NetAppBackupVaultResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: netAppValidate.VolumeQuotaRuleName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "account_name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: netAppValidate.AccountName, + }, + + "tags": commonschema.Tags(), + } +} + +func (r NetAppBackupVaultResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r NetAppBackupVaultResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 90 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupVaultsClient + subscriptionId := metadata.Client.Account.SubscriptionId + + var model netAppModels.NetAppBackupVaultModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := backupvaults.NewBackupVaultID(subscriptionId, model.ResourceGroupName, model.AccountName, model.Name) + + metadata.Logger.Infof("Import check for %s", id) + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %s", id, err) + } + } + + if !response.WasNotFound(existing.HttpResponse) { + return tf.ImportAsExistsError(r.ResourceType(), id.ID()) + } + + parameters := backupvaults.BackupVault{ + Location: location.Normalize(model.Location), + Tags: pointer.To(model.Tags), + } + + err = client.CreateOrUpdateThenPoll(ctx, id, parameters) + if err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + + return nil + }, + } +} + +func (r NetAppBackupVaultResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 120 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupVaultsClient + + id, err := backupvaults.ParseBackupVaultID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Decoding state for %s", id) + var state netAppModels.NetAppBackupVaultModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + if metadata.ResourceData.HasChange("tags") { + metadata.Logger.Infof("Updating %s", id) + + update := backupvaults.BackupVaultPatch{ + Tags: pointer.To(state.Tags), + } + + if err := client.UpdateThenPoll(ctx, pointer.From(id), update); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + } + + return nil + }, + } +} + +func (r NetAppBackupVaultResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.NetApp.BackupVaultsClient + + id, err := backupvaults.ParseBackupVaultID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("Decoding state for %s", id) + var state netAppModels.NetAppBackupVaultModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, pointer.From(id)) + if err != nil { + if response.WasNotFound(existing.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("retrieving %s: %v", id, err) + } + + state.AccountName = id.NetAppAccountName + state.Name = id.BackupVaultName + state.ResourceGroupName = id.ResourceGroupName + + if model := existing.Model; model != nil { + state.Location = location.Normalize(model.Location) + state.Tags = pointer.From(model.Tags) + } + + metadata.SetID(id) + + return metadata.Encode(&state) + }, + } +} + +func waitForBackupDeletion(ctx context.Context, client *backups.BackupsClient, id backups.BackupId) error { + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") + } + stateConf := &pluginsdk.StateChangeConf{ + ContinuousTargetOccurence: 5, + Delay: 5 * time.Second, + MinTimeout: 5 * time.Second, + Pending: []string{"200", "202"}, + Target: []string{"404"}, + Refresh: netappBackupStateRefreshFunc(ctx, client, id), + Timeout: time.Until(deadline), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to be deleted: %+v", id, err) + } + + return nil +} + +func netappBackupStateRefreshFunc(ctx context.Context, client *backups.BackupsClient, id backups.BackupId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) + } + } + + statusCode := "dropped connection" + if res.HttpResponse != nil { + statusCode = strconv.Itoa(res.HttpResponse.StatusCode) + } + + return res, statusCode, nil + } +} + +func (r NetAppBackupVaultResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 120 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + vaultClient := metadata.Client.NetApp.BackupVaultsClient + backupClient := metadata.Client.NetApp.BackupClient + + id, err := backupvaults.ParseBackupVaultID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + // Attempt to delete backup vault with retries + for retries := 0; retries < 5; retries++ { + // Delete backups + if err := deleteBackupsFromVault(ctx, id, backupClient, metadata.Client.Features.NetApp.DeleteBackupsOnBackupVaultDestroy); err != nil { + return err + } + + // DeleteThenPoll cannot be used due to potential race condition where the backup started when the volume got deleted but it takes time for it to show up within the vault + // This will be handled by waitForBackupVaultDeletion and operation will be retried if needed + if _, err := vaultClient.Delete(ctx, pointer.From(id)); err != nil { + return fmt.Errorf("deleting %s: %+v", id, err) + } + + // Wait for deletion to complete + err = waitForBackupVaultDeletion(ctx, vaultClient, backupClient, pointer.From(id)) + if err == nil { + return nil // Successful deletion + } + + if strings.Contains(err.Error(), "backups found on vault") { + // Backup may not show up in the vault through a GET so we will wait for a bit before retrying + time.Sleep(30 * time.Second) + continue + } + + return err // If it's a different error, return it immediately + } + + return fmt.Errorf("failed to delete backup vault after 5 attempts") + }, + } +} + +func waitForBackupVaultDeletion(ctx context.Context, vaultClient *backupvaults.BackupVaultsClient, backupClient *backups.BackupsClient, id backupvaults.BackupVaultId) error { + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") + } + stateConf := &pluginsdk.StateChangeConf{ + ContinuousTargetOccurence: 5, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + Pending: []string{"200", "202"}, + Target: []string{"404"}, + Refresh: netappBackupVaultStateRefreshFunc(ctx, vaultClient, backupClient, id), + Timeout: time.Until(deadline), + } + + _, err := stateConf.WaitForStateContext(ctx) + if err != nil { + return fmt.Errorf("waiting for deletion of %s: %w", id, err) + } + + return nil +} + +func netappBackupVaultStateRefreshFunc(ctx context.Context, vaultClient *backupvaults.BackupVaultsClient, backupClient *backups.BackupsClient, id backupvaults.BackupVaultId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := vaultClient.Get(ctx, id) + if err != nil { + if response.WasNotFound(res.HttpResponse) { + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil + } + return nil, "", fmt.Errorf("retrieving %s: %s", id, err) + } + + // Handling a race condition where the backup started but the volume got deleted and it takes time for it to show up within the vault. + // The vault deletion process will hang until the deadline is reached and never retry to delete the backup preventing vault to be deleted. + // For this to work, need to scrub activity logs to see if there was a failed deletion operation due to backup just showing up in the vault + // midway after the vault deletion process started. + backupVaultID := backups.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.BackupVaultName) + backupList, err := backupClient.ListByVault(ctx, backupVaultID, backups.ListByVaultOperationOptions{}) + if err != nil { + return nil, "", fmt.Errorf("listing backups from vault %s: %w", id.ID(), err) + } + + if backupList.Model != nil || len(pointer.From(backupList.Model)) > 0 { + return nil, "409", fmt.Errorf("backups found on vault %s, forcing retry", id.ID()) // Forcing vault deletion to retry + } + + return res, strconv.Itoa(res.HttpResponse.StatusCode), nil + } +} + +func deleteBackupsFromVault(ctx context.Context, id *backupvaults.BackupVaultId, backupClient *backups.BackupsClient, shouldDestroyBackups bool) error { + for { + backupVaultID := backups.NewBackupVaultID(id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.BackupVaultName) + backupList, err := backupClient.ListByVault(ctx, backupVaultID, backups.ListByVaultOperationOptions{}) + if err != nil { + return fmt.Errorf("listing backups from vault %s: %w", id.ID(), err) + } + + if backupList.Model == nil || len(pointer.From(backupList.Model)) == 0 { + return nil // No more backups to delete + } + + for _, backup := range pointer.From(backupList.Model) { + if backup.Name == nil { + continue + } + + if shouldDestroyBackups { + backupID, err := backups.ParseBackupID(pointer.From(backup.Id)) + if err != nil { + return fmt.Errorf("parsing backup ID %s: %w", pointer.From(backup.Id), err) + } + + if err := retryBackupDelete(ctx, backupClient, pointer.From(backupID), 120, 30); err != nil { + return fmt.Errorf("failed to delete backup %s: %w", backupID.ID(), err) + } + } else { + return fmt.Errorf("cannot delete backups from backup vault due to missing DeleteBackupsOnBackupVaultDestroy feature set as true, backup vault id %s, DeleteBackupsOnBackupVaultDestroy setting is: %t", id.ID(), shouldDestroyBackups) + } + } + + time.Sleep(10 * time.Second) + } +} + +func retryBackupDelete(ctx context.Context, client *backups.BackupsClient, id backups.BackupId, retryAttempts, retryIntervalSec int) error { + var lastErr error + for attempt := 0; attempt < retryAttempts; attempt++ { + if err := client.DeleteThenPoll(ctx, id); err == nil { + if err := waitForBackupDeletion(ctx, client, id); err != nil { + return fmt.Errorf("waiting for deletion of %s: %w", id.ID(), err) + } + return nil + } else if strings.Contains(err.Error(), "Please retry after backup transfer is complete") { + lastErr = err + time.Sleep(time.Duration(retryIntervalSec) * time.Second) + } else { + return fmt.Errorf("deleting backup %s: %+v", id.ID(), err) + } + } + + return fmt.Errorf("failed to delete backup after %d attempts: %v", retryAttempts, lastErr) +} diff --git a/internal/services/netapp/netapp_backup_vault_test.go b/internal/services/netapp/netapp_backup_vault_test.go new file mode 100644 index 000000000000..0f4472577645 --- /dev/null +++ b/internal/services/netapp/netapp_backup_vault_test.go @@ -0,0 +1,149 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package netapp_test + +import ( + "context" + "fmt" + "net/http" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults" + "github.com/hashicorp/terraform-plugin-testing/terraform" + "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/utils" +) + +type NetAppBackupVaultResource struct{} + +func (t NetAppBackupVaultResource) Exists(ctx context.Context, clients *clients.Client, state *terraform.InstanceState) (*bool, error) { + id, err := backupvaults.ParseBackupVaultID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.NetApp.BackupVaultsClient.Get(ctx, *id) + if err != nil { + if resp.HttpResponse.StatusCode == http.StatusNotFound { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", id, err) + } + + return utils.Bool(true), nil +} + +func TestAccNetAppBackupVault_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_backup_vault", "test") + r := NetAppBackupVaultResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + data.ImportStep(), + }) +} + +func TestAccNetAppBackupVault_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_backup_vault", "test") + r := NetAppBackupVaultResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("1"), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + check.That(data.ResourceName).Key("tags.%").HasValue("2"), + ), + }, + data.ImportStep(), + }) +} + +func (r NetAppBackupVaultResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_netapp_backup_vault" "test" { + name = "acctest-NetAppBackupVault-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + + tags = { + "testTag" = "testTagValue" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r NetAppBackupVaultResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%[1]s + +resource "azurerm_netapp_backup_vault" "test" { + name = "acctest-NetAppBackupVault-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + + tags = { + "testTag" = "testTagValue", + "FoO" = "BaR" + } +} +`, r.template(data), data.RandomInteger) +} + +func (NetAppBackupVaultResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + netapp { + delete_backups_on_backup_vault_destroy = true + } + } +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-netapp-%[1]d" + location = "%[2]s" + + tags = { + "SkipNRMSNSG" = "true" + } +} + +resource "azurerm_netapp_account" "test" { + name = "acctest-NetAppAccount-%[1]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + + tags = { + "CreatedOnDate" = "2023-08-17T08:01:00Z", + "SkipASMAzSecPack" = "true" + } +} + + +`, data.RandomInteger, data.Locations.Primary) +} diff --git a/internal/services/netapp/netapp_pool_data_source.go b/internal/services/netapp/netapp_pool_data_source.go index 68f0557ab3c6..3451735b1d33 100644 --- a/internal/services/netapp/netapp_pool_data_source.go +++ b/internal/services/netapp/netapp_pool_data_source.go @@ -11,7 +11,7 @@ import ( "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/2023-05-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/netapp/netapp_pool_resource.go b/internal/services/netapp/netapp_pool_resource.go index 039e5a6527fc..0e5b14ab45f8 100644 --- a/internal/services/netapp/netapp_pool_resource.go +++ b/internal/services/netapp/netapp_pool_resource.go @@ -14,7 +14,7 @@ import ( "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/2023-05-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" @@ -170,14 +170,11 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error return err } - shouldUpdate := false update := capacitypools.CapacityPoolPatch{ Properties: &capacitypools.PoolPatchProperties{}, } if d.HasChange("size_in_tb") { - shouldUpdate = true - sizeInTB := int64(d.Get("size_in_tb").(int)) sizeInMB := sizeInTB * 1024 * 1024 sizeInBytes := sizeInMB * 1024 * 1024 @@ -186,26 +183,22 @@ func resourceNetAppPoolUpdate(d *pluginsdk.ResourceData, meta interface{}) error } if d.HasChange("qos_type") { - shouldUpdate = true qosType := capacitypools.QosType(d.Get("qos_type").(string)) update.Properties.QosType = &qosType } if d.HasChange("tags") { - shouldUpdate = true tagsRaw := d.Get("tags").(map[string]interface{}) update.Tags = tags.Expand(tagsRaw) } - if shouldUpdate { - if err = client.PoolsUpdateThenPoll(ctx, *id, update); err != nil { - return fmt.Errorf("updating %s: %+v", id.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 { - return err - } + // Wait for pool to complete update + if err = waitForPoolCreateOrUpdate(ctx, client, *id); err != nil { + return err } return resourceNetAppPoolRead(d, meta) diff --git a/internal/services/netapp/netapp_pool_resource_test.go b/internal/services/netapp/netapp_pool_resource_test.go index 1b05fa0c779b..2afc819cac93 100644 --- a/internal/services/netapp/netapp_pool_resource_test.go +++ b/internal/services/netapp/netapp_pool_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" diff --git a/internal/services/netapp/netapp_snapshot_data_source.go b/internal/services/netapp/netapp_snapshot_data_source.go index 4c1300a1f1da..cb38e1bfdde9 100644 --- a/internal/services/netapp/netapp_snapshot_data_source.go +++ b/internal/services/netapp/netapp_snapshot_data_source.go @@ -10,7 +10,7 @@ import ( "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/2023-05-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/netapp/netapp_snapshot_policy_data_source.go b/internal/services/netapp/netapp_snapshot_policy_data_source.go index 4cb8f42e42a4..0cdff64dc7d7 100644 --- a/internal/services/netapp/netapp_snapshot_policy_data_source.go +++ b/internal/services/netapp/netapp_snapshot_policy_data_source.go @@ -10,7 +10,7 @@ import ( "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/2023-05-01/snapshotpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tags" diff --git a/internal/services/netapp/netapp_snapshot_policy_resource.go b/internal/services/netapp/netapp_snapshot_policy_resource.go index 478b708eaabd..2a0511a5c727 100644 --- a/internal/services/netapp/netapp_snapshot_policy_resource.go +++ b/internal/services/netapp/netapp_snapshot_policy_resource.go @@ -14,7 +14,7 @@ import ( "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/2023-05-01/snapshotpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" diff --git a/internal/services/netapp/netapp_snapshot_policy_resource_test.go b/internal/services/netapp/netapp_snapshot_policy_resource_test.go index 6728c2c036d4..0e0a9d878ecb 100644 --- a/internal/services/netapp/netapp_snapshot_policy_resource_test.go +++ b/internal/services/netapp/netapp_snapshot_policy_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" diff --git a/internal/services/netapp/netapp_snapshot_resource.go b/internal/services/netapp/netapp_snapshot_resource.go index 1fc1180191c7..cf729cc41f91 100644 --- a/internal/services/netapp/netapp_snapshot_resource.go +++ b/internal/services/netapp/netapp_snapshot_resource.go @@ -12,7 +12,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" diff --git a/internal/services/netapp/netapp_snapshot_resource_test.go b/internal/services/netapp/netapp_snapshot_resource_test.go index 498587b03326..6fbc24bfd4d5 100644 --- a/internal/services/netapp/netapp_snapshot_resource_test.go +++ b/internal/services/netapp/netapp_snapshot_resource_test.go @@ -8,7 +8,7 @@ import ( "fmt" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" @@ -128,7 +128,15 @@ resource "azurerm_netapp_snapshot" "test" { func (NetAppSnapshotResource) template(data acceptance.TestData) string { return fmt.Sprintf(` provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + netapp { + prevent_volume_destruction = false + delete_backups_on_backup_vault_destroy = true + } + } } resource "azurerm_resource_group" "test" { diff --git a/internal/services/netapp/netapp_volume_data_source.go b/internal/services/netapp/netapp_volume_data_source.go index 49b7d826c0c5..ee6b8b3a5eb5 100644 --- a/internal/services/netapp/netapp_volume_data_source.go +++ b/internal/services/netapp/netapp_volume_data_source.go @@ -12,7 +12,7 @@ import ( "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/2023-05-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -121,6 +121,29 @@ func dataSourceNetAppVolume() *pluginsdk.Resource { }, }, + "data_protection_backup_policy": { + Type: pluginsdk.TypeList, + Computed: true, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "backup_policy_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + + "policy_enabled": { + Type: pluginsdk.TypeBool, + Computed: true, + }, + + "backup_vault_id": { + Type: pluginsdk.TypeString, + Computed: true, + }, + }, + }, + }, + "encryption_key_source": { Type: pluginsdk.TypeString, Computed: true, @@ -212,6 +235,9 @@ func dataSourceNetAppVolumeRead(d *pluginsdk.ResourceData, meta interface{}) err if err := d.Set("data_protection_replication", flattenNetAppVolumeDataProtectionReplication(props.DataProtection)); err != nil { return fmt.Errorf("setting `data_protection_replication`: %+v", err) } + if err := d.Set("data_protection_backup_policy", flattenNetAppVolumeDataProtectionBackupPolicy(props.DataProtection)); err != nil { + return fmt.Errorf("setting `data_protection_backup_policy`: %+v", err) + } } return nil diff --git a/internal/services/netapp/netapp_volume_data_source_test.go b/internal/services/netapp/netapp_volume_data_source_test.go index 9319ae4230a5..20e26ec96948 100644 --- a/internal/services/netapp/netapp_volume_data_source_test.go +++ b/internal/services/netapp/netapp_volume_data_source_test.go @@ -34,6 +34,20 @@ func TestAccDataSourceNetAppVolume_basic(t *testing.T) { }) } +func TestAccDataSourceNetAppVolume_backupPolicy(t *testing.T) { + data := acceptance.BuildTestData(t, "data.azurerm_netapp_volume", "test") + r := NetAppVolumeDataSource{} + + data.DataSourceTest(t, []acceptance.TestStep{ + { + Config: r.backupPolicy(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).Key("data_protection_backup_policy.#").HasValue("1"), + ), + }, + }) +} + func (NetAppVolumeDataSource) basic(data acceptance.TestData) string { return fmt.Sprintf(` %s @@ -44,6 +58,10 @@ provider "azurerm" { resource_group { prevent_deletion_if_contains_resources = false } + netapp { + prevent_volume_destruction = false + delete_backups_on_backup_vault_destroy = true + } } } @@ -55,3 +73,25 @@ data "azurerm_netapp_volume" "test" { } `, NetAppVolumeResource{}.basic(data)) } + +func (NetAppVolumeDataSource) backupPolicy(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +provider "azurerm" { + alias = "all" + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } +} + +data "azurerm_netapp_volume" "test" { + resource_group_name = azurerm_netapp_volume.test.resource_group_name + account_name = azurerm_netapp_volume.test.account_name + pool_name = azurerm_netapp_volume.test.pool_name + name = azurerm_netapp_volume.test.name +} +`, NetAppVolumeResource{}.backupPolicy(data)) +} diff --git a/internal/services/netapp/netapp_volume_group_sap_hana_data_source.go b/internal/services/netapp/netapp_volume_group_sap_hana_data_source.go index e8f03834b88c..7aedf41ca471 100644 --- a/internal/services/netapp/netapp_volume_group_sap_hana_data_source.go +++ b/internal/services/netapp/netapp_volume_group_sap_hana_data_source.go @@ -12,7 +12,7 @@ import ( "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/2023-05-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -254,7 +254,6 @@ func (r NetAppVolumeGroupSapHanaDataSource) Read() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: %v", id, err) } - metadata.SetID(id) if model := resp.Model; model != nil { state.Location = location.Normalize(pointer.From(model.Location)) if props := model.Properties; props != nil { @@ -271,6 +270,8 @@ func (r NetAppVolumeGroupSapHanaDataSource) Read() sdk.ResourceFunc { } } + metadata.SetID(id) + return metadata.Encode(&state) }, } diff --git a/internal/services/netapp/netapp_volume_group_sap_hana_resource.go b/internal/services/netapp/netapp_volume_group_sap_hana_resource.go index 4f7a0ddd9865..c8c5e76f1883 100644 --- a/internal/services/netapp/netapp_volume_group_sap_hana_resource.go +++ b/internal/services/netapp/netapp_volume_group_sap_hana_resource.go @@ -15,10 +15,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" @@ -342,10 +342,6 @@ func (r NetAppVolumeGroupSapHanaResource) Create() sdk.ResourceFunc { } } - // TODO: deploymentSpecId is temporary until the backend is updated and deploymentSpecId is not required anymore, - // it will be handled internally by the RP - deploymentSpecId := "20542149-bfca-5618-1879-9863dc6767f1" - parameters := volumegroups.VolumeGroupDetails{ Location: utils.String(location.Normalize(model.Location)), Properties: &volumegroups.VolumeGroupProperties{ @@ -353,7 +349,6 @@ func (r NetAppVolumeGroupSapHanaResource) Create() sdk.ResourceFunc { GroupDescription: utils.String(model.GroupDescription), ApplicationType: pointer.To(volumegroups.ApplicationTypeSAPNegativeHANA), ApplicationIdentifier: utils.String(model.ApplicationIdentifier), - DeploymentSpecId: utils.String(deploymentSpecId), }, Volumes: volumeList, }, @@ -430,7 +425,7 @@ func (r NetAppVolumeGroupSapHanaResource) Update() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppVolumeGroupSapHanaModel if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } metadata.Logger.Infof("Updating %s", id) @@ -543,7 +538,7 @@ func (r NetAppVolumeGroupSapHanaResource) Read() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppVolumeGroupSapHanaModel if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } existing, err := client.Get(ctx, pointer.From(id)) @@ -554,8 +549,6 @@ func (r NetAppVolumeGroupSapHanaResource) Read() sdk.ResourceFunc { return fmt.Errorf("retrieving %s: %v", id, err) } - metadata.SetID(id) - model := netAppModels.NetAppVolumeGroupSapHanaModel{ Name: id.VolumeGroupName, AccountName: id.NetAppAccountName, @@ -575,6 +568,8 @@ func (r NetAppVolumeGroupSapHanaResource) Read() sdk.ResourceFunc { model.Volumes = volumes } + metadata.SetID(id) + return metadata.Encode(&model) }, } diff --git a/internal/services/netapp/netapp_volume_group_sap_hana_resource_test.go b/internal/services/netapp/netapp_volume_group_sap_hana_resource_test.go index 1f4046017dce..e4a128be7f51 100644 --- a/internal/services/netapp/netapp_volume_group_sap_hana_resource_test.go +++ b/internal/services/netapp/netapp_volume_group_sap_hana_resource_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -1606,6 +1606,10 @@ provider "azurerm" { resource_group { prevent_deletion_if_contains_resources = false } + netapp { + prevent_volume_destruction = false + delete_backups_on_backup_vault_destroy = true + } } } diff --git a/internal/services/netapp/netapp_volume_helper.go b/internal/services/netapp/netapp_volume_helper.go index dffa0223f7e2..67c93b7cfe42 100644 --- a/internal/services/netapp/netapp_volume_helper.go +++ b/internal/services/netapp/netapp_volume_helper.go @@ -6,16 +6,16 @@ package netapp import ( "context" "fmt" - "net/http" "strconv" "strings" "time" "github.com/hashicorp/go-azure-helpers/lang/pointer" "github.com/hashicorp/go-azure-helpers/lang/response" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" @@ -273,6 +273,58 @@ func expandNetAppVolumeDataProtectionSnapshotPolicyPatch(input []interface{}) *v } } +func expandNetAppVolumeDataProtectionBackupPolicy(input []interface{}) *volumes.VolumePropertiesDataProtection { + if len(input) == 0 || input == nil { + return &volumes.VolumePropertiesDataProtection{} + } + + backupPolicyObject := volumes.VolumeBackupProperties{} + + backupRaw := input[0].(map[string]interface{}) + + if v, ok := backupRaw["backup_policy_id"]; ok { + backupPolicyObject.BackupPolicyId = utils.String(v.(string)) + } + + if v, ok := backupRaw["policy_enabled"]; ok { + backupPolicyObject.PolicyEnforced = utils.Bool(v.(bool)) + } + + if v, ok := backupRaw["backup_vault_id"]; ok { + backupPolicyObject.BackupVaultId = utils.String(v.(string)) + } + + return &volumes.VolumePropertiesDataProtection{ + Backup: &backupPolicyObject, + } +} + +func expandNetAppVolumeDataProtectionBackupPolicyPatch(input []interface{}) *volumes.VolumePatchPropertiesDataProtection { + if len(input) == 0 || input == nil { + return &volumes.VolumePatchPropertiesDataProtection{} + } + + backupPolicyObject := volumes.VolumeBackupProperties{} + + backupRaw := input[0].(map[string]interface{}) + + if v, ok := backupRaw["backup_policy_id"]; ok { + backupPolicyObject.BackupPolicyId = utils.String(v.(string)) + } + + if v, ok := backupRaw["policy_enabled"]; ok { + backupPolicyObject.PolicyEnforced = utils.Bool(v.(bool)) + } + + if v, ok := backupRaw["backup_vault_id"]; ok { + backupPolicyObject.BackupVaultId = utils.String(v.(string)) + } + + return &volumes.VolumePatchPropertiesDataProtection{ + Backup: &backupPolicyObject, + } +} + func flattenNetAppVolumeGroupVolumes(ctx context.Context, input *[]volumegroups.VolumeGroupVolumeProperties, metadata sdk.ResourceMetaData) ([]netAppModels.NetAppVolumeGroupVolume, error) { results := make([]netAppModels.NetAppVolumeGroupVolume, 0) @@ -436,7 +488,7 @@ func deleteVolume(ctx context.Context, metadata sdk.ResourceMetaData, volumeId s existing, err := client.Get(ctx, pointer.From(id)) if err != nil { - if existing.HttpResponse.StatusCode == http.StatusNotFound { + if response.WasNotFound(existing.HttpResponse) { return metadata.MarkAsGone(id) } return fmt.Errorf("retrieving %s: %v", id, err) @@ -493,7 +545,7 @@ func deleteVolume(ctx context.Context, metadata sdk.ResourceMetaData, volumeId s } } - // Deleting volume and waiting for it fo fully complete the operation + // Deleting volume and waiting for it to fully complete the operation if err = client.DeleteThenPoll(ctx, pointer.From(id), volumes.DeleteOperationOptions{ ForceDelete: utils.Bool(true), }); err != nil { @@ -640,6 +692,28 @@ func waitForVolumeDeletion(ctx context.Context, client *volumes.VolumesClient, i return nil } +func waitForBackupRelationshipStateForDeletion(ctx context.Context, client *backups.BackupsClient, id backups.VolumeId) error { + deadline, ok := ctx.Deadline() + if !ok { + return fmt.Errorf("internal-error: context had no deadline") + } + stateConf := &pluginsdk.StateChangeConf{ + ContinuousTargetOccurence: 5, + Delay: 10 * time.Second, + MinTimeout: 10 * time.Second, + Pending: []string{"200"}, // 200 means not in the state we need for backup + Target: []string{"204"}, // 204 means backup is in a state that need (! transitioning) + Refresh: netappVolumeBackupRelationshipStateForDeletionRefreshFunc(ctx, client, id), + Timeout: time.Until(deadline), + } + + if _, err := stateConf.WaitForStateContext(ctx); err != nil { + return fmt.Errorf("waiting for %s to not be in the transferring state", id) + } + + return nil +} + func netappVolumeStateRefreshFunc(ctx context.Context, client *volumes.VolumesClient, id volumes.VolumeId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { res, err := client.Get(ctx, id) @@ -703,6 +777,25 @@ func netappVolumeReplicationMirrorStateRefreshFunc(ctx context.Context, client * } } +func netappVolumeBackupRelationshipStateForDeletionRefreshFunc(ctx context.Context, client *backups.BackupsClient, id backups.VolumeId) pluginsdk.StateRefreshFunc { + return func() (interface{}, string, error) { + res, err := client.GetLatestStatus(ctx, id) + if err != nil { + if !response.WasNotFound(res.HttpResponse) { + return nil, "", fmt.Errorf("retrieving backup relationship status information from %s: %s", id, err) + } + } + + response := 200 + if res.Model != nil && res.Model.RelationshipStatus != nil && *res.Model.RelationshipStatus != backups.RelationshipStatusTransferring { + // return 204 if state matches desired state + response = 204 + } + + return res, strconv.Itoa(response), nil + } +} + func netappVolumeReplicationStateRefreshFunc(ctx context.Context, client *volumesreplication.VolumesReplicationClient, id volumesreplication.VolumeId) pluginsdk.StateRefreshFunc { return func() (interface{}, string, error) { res, err := client.VolumesReplicationStatus(ctx, id) diff --git a/internal/services/netapp/netapp_volume_quota_rule_data_source.go b/internal/services/netapp/netapp_volume_quota_rule_data_source.go index 84fbc1474dd8..d7084a0bfdc8 100644 --- a/internal/services/netapp/netapp_volume_quota_rule_data_source.go +++ b/internal/services/netapp/netapp_volume_quota_rule_data_source.go @@ -12,8 +12,8 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/pointer" "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/2023-05-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" diff --git a/internal/services/netapp/netapp_volume_quota_rule_resource.go b/internal/services/netapp/netapp_volume_quota_rule_resource.go index 7d798571aa7e..5dc39c9e63af 100644 --- a/internal/services/netapp/netapp_volume_quota_rule_resource.go +++ b/internal/services/netapp/netapp_volume_quota_rule_resource.go @@ -6,15 +6,14 @@ package netapp import ( "context" "fmt" - "net/http" "time" "github.com/hashicorp/go-azure-helpers/lang/pointer" "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/2023-05-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/helpers/tf" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" @@ -155,21 +154,22 @@ func (r NetAppVolumeQuotaRuleResource) Update() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppVolumeQuotaRuleModel if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } - metadata.Logger.Infof("Updating %s", id) + if metadata.ResourceData.HasChange("quota_size_in_kib") { + metadata.Logger.Infof("Updating %s", id) - update := volumequotarules.VolumeQuotaRulePatch{ - Properties: &volumequotarules.VolumeQuotaRulesProperties{}, - } + update := volumequotarules.VolumeQuotaRulePatch{ + Properties: &volumequotarules.VolumeQuotaRulesProperties{}, + } - update.Properties.QuotaSizeInKiBs = utils.Int64(state.QuotaSizeInKiB) - if err := client.UpdateThenPoll(ctx, pointer.From(id), update); err != nil { - return fmt.Errorf("updating %s: %+v", id, err) - } + update.Properties.QuotaSizeInKiBs = utils.Int64(state.QuotaSizeInKiB) - metadata.SetID(id) + if err := client.UpdateThenPoll(ctx, pointer.From(id), update); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + } return nil }, @@ -190,12 +190,12 @@ func (r NetAppVolumeQuotaRuleResource) Read() sdk.ResourceFunc { metadata.Logger.Infof("Decoding state for %s", id) var state netAppModels.NetAppVolumeQuotaRuleModel if err := metadata.Decode(&state); err != nil { - return err + return fmt.Errorf("decoding: %+v", err) } existing, err := client.Get(ctx, pointer.From(id)) if err != nil { - if existing.HttpResponse.StatusCode == http.StatusNotFound { + if response.WasNotFound(existing.HttpResponse) { return metadata.MarkAsGone(id) } return fmt.Errorf("retrieving %s: %v", id, err) @@ -206,7 +206,7 @@ func (r NetAppVolumeQuotaRuleResource) Read() sdk.ResourceFunc { model := netAppModels.NetAppVolumeQuotaRuleModel{ Name: id.VolumeQuotaRuleName, VolumeID: volumeID.ID(), - Location: location.NormalizeNilable(pointer.To(existing.Model.Location)), + Location: location.Normalize(existing.Model.Location), QuotaTarget: pointer.From(existing.Model.Properties.QuotaTarget), QuotaSizeInKiB: pointer.From(existing.Model.Properties.QuotaSizeInKiBs), QuotaType: string(pointer.From(existing.Model.Properties.QuotaType)), @@ -232,7 +232,7 @@ func (r NetAppVolumeQuotaRuleResource) Delete() sdk.ResourceFunc { existing, err := client.Get(ctx, pointer.From(id)) if err != nil { - if existing.HttpResponse.StatusCode == http.StatusNotFound { + if response.WasNotFound(existing.HttpResponse) { return metadata.MarkAsGone(id) } return fmt.Errorf("retrieving %s: %v", id, err) diff --git a/internal/services/netapp/netapp_volume_quota_rule_resource_test.go b/internal/services/netapp/netapp_volume_quota_rule_resource_test.go index 38d1eaf4eab2..54c260dccd46 100644 --- a/internal/services/netapp/netapp_volume_quota_rule_resource_test.go +++ b/internal/services/netapp/netapp_volume_quota_rule_resource_test.go @@ -9,7 +9,7 @@ import ( "net/http" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" "github.com/hashicorp/terraform-plugin-testing/terraform" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" @@ -166,6 +166,10 @@ provider "azurerm" { resource_group { prevent_deletion_if_contains_resources = false } + netapp { + prevent_volume_destruction = false + delete_backups_on_backup_vault_destroy = true + } } } diff --git a/internal/services/netapp/netapp_volume_resource.go b/internal/services/netapp/netapp_volume_resource.go index 8199516d8ded..84a45eb5a9b1 100644 --- a/internal/services/netapp/netapp_volume_resource.go +++ b/internal/services/netapp/netapp_volume_resource.go @@ -15,9 +15,10 @@ import ( "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" "github.com/hashicorp/go-azure-helpers/resourcemanager/tags" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" @@ -268,7 +269,7 @@ func resourceNetAppVolume() *pluginsdk.Resource { "snapshot_directory_visible": { Type: pluginsdk.TypeBool, Optional: true, - Computed: true, + Default: true, }, "data_protection_replication": { @@ -323,6 +324,36 @@ func resourceNetAppVolume() *pluginsdk.Resource { }, }, + "data_protection_backup_policy": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "backup_policy_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, + Description: "The ID of the backup policy to associate with this volume.", + }, + + "policy_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: true, + Description: "If set to false, the backup policy will not be enabled on this volume, thus disabling scheduled backups.", + }, + + "backup_vault_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: azure.ValidateResourceID, + Description: "The ID of the backup vault to associate with this volume.", + }, + }, + }, + }, + "azure_vmware_data_store_enabled": { Type: pluginsdk.TypeBool, ForceNew: true, @@ -432,25 +463,36 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err exportPolicyRule := expandNetAppVolumeExportPolicyRule(exportPolicyRuleRaw) dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) - dataProtectionSnapshotPolicyRaw := d.Get("data_protection_snapshot_policy").([]interface{}) - dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) + + dataProtectionSnapshotPolicyRaw := d.Get("data_protection_snapshot_policy").([]interface{}) dataProtectionSnapshotPolicy := expandNetAppVolumeDataProtectionSnapshotPolicy(dataProtectionSnapshotPolicyRaw) + dataProtectionBackupPolicyRaw := d.Get("data_protection_backup_policy").([]interface{}) + dataProtectionBackupPolicy := expandNetAppVolumeDataProtectionBackupPolicy(dataProtectionBackupPolicyRaw) + authorizeReplication := false volumeType := "" + endpointType := "" if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil { - endpointType := "" if dataProtectionReplication.Replication.EndpointType != nil { endpointType = string(*dataProtectionReplication.Replication.EndpointType) } - if strings.ToLower(endpointType) == "dst" { + if strings.EqualFold(endpointType, "dst") { authorizeReplication = true volumeType = "DataProtection" } } - // Validating that snapshot policies are not being created in a data protection volume + // Validate applicability of backup policies + if dataProtectionReplication != nil && dataProtectionReplication.Backup != nil { + // Validate that backup policies are not being enforced in a data protection replication destination volume + if strings.EqualFold(volumeType, "dst") && dataProtectionReplication.Backup.PolicyEnforced == utils.Bool(true) { + return fmt.Errorf("backup policy cannot be enforced on a data protection destination volume, NetApp Volume %q (Resource Group %q)", id.VolumeName, id.ResourceGroupName) + } + } + + // Validating that snapshot policies are not being created in a data protection replication 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.VolumeName, id.ResourceGroupName) } @@ -541,6 +583,7 @@ func resourceNetAppVolumeCreate(d *pluginsdk.ResourceData, meta interface{}) err DataProtection: &volumes.VolumePropertiesDataProtection{ Replication: dataProtectionReplication.Replication, Snapshot: dataProtectionSnapshotPolicy.Snapshot, + Backup: dataProtectionBackupPolicy.Backup, }, AvsDataStore: &avsDataStoreEnabled, SnapshotDirectoryVisible: utils.Bool(snapshotDirectoryVisible), @@ -612,7 +655,6 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err return err } - shouldUpdate := false update := volumes.VolumePatch{ Properties: &volumes.VolumePatchProperties{}, } @@ -621,14 +663,17 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("zone changes are not supported after volume is already created, %s", id) } + if d.HasChange("snapshot_directory_visible") { + snapshotDirectoryVisible := d.Get("snapshot_directory_visible").(bool) + update.Properties.SnapshotDirectoryVisible = pointer.To(snapshotDirectoryVisible) + } + if d.HasChange("storage_quota_in_gb") { - shouldUpdate = true storageQuotaInBytes := int64(d.Get("storage_quota_in_gb").(int) * 1073741824) 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.Properties.ExportPolicy = exportPolicyRule @@ -639,24 +684,41 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) - if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && dataProtectionReplication.Replication.EndpointType != nil && strings.ToLower(string(*dataProtectionReplication.Replication.EndpointType)) == "dst" { + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && dataProtectionReplication.Replication.EndpointType != nil && strings.EqualFold(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.Properties.DataProtection = dataProtectionSnapshotPolicy + + update.Properties.DataProtection = &volumes.VolumePatchPropertiesDataProtection{} + update.Properties.DataProtection.Snapshot = dataProtectionSnapshotPolicy.Snapshot + } + + if d.HasChange("data_protection_backup_policy") { + // Validate applicability of backup policies + dataProtectionReplicationRaw := d.Get("data_protection_replication").([]interface{}) + dataProtectionReplication := expandNetAppVolumeDataProtectionReplication(dataProtectionReplicationRaw) + + if dataProtectionReplication != nil && dataProtectionReplication.Replication != nil && dataProtectionReplication.Replication.EndpointType != nil && strings.EqualFold(string(*dataProtectionReplication.Replication.EndpointType), "dst") { + return fmt.Errorf("snapshot policy cannot be enabled on a data protection volume, %s", id) + } + + dataProtectionBackupPolicyRaw := d.Get("data_protection_backup_policy").([]interface{}) + dataProtectionBackupPolicy := expandNetAppVolumeDataProtectionBackupPolicyPatch(dataProtectionBackupPolicyRaw) + + if update.Properties.DataProtection == nil { + update.Properties.DataProtection = &volumes.VolumePatchPropertiesDataProtection{} + } + update.Properties.DataProtection.Backup = dataProtectionBackupPolicy.Backup } if d.HasChange("throughput_in_mibps") { - shouldUpdate = true throughputMibps := d.Get("throughput_in_mibps") update.Properties.ThroughputMibps = utils.Float(throughputMibps.(float64)) } if d.HasChange("smb_non_browsable_enabled") { - shouldUpdate = true smbNonBrowsable := volumes.SmbNonBrowsableDisabled update.Properties.SmbNonBrowsable = &smbNonBrowsable if d.Get("smb_non_browsable_enabled").(bool) { @@ -666,7 +728,6 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err } if d.HasChange("smb_access_based_enumeration_enabled") { - shouldUpdate = true smbAccessBasedEnumeration := volumes.SmbAccessBasedEnumerationDisabled update.Properties.SmbAccessBasedEnumeration = &smbAccessBasedEnumeration if d.Get("smb_access_based_enumeration_enabled").(bool) { @@ -676,20 +737,17 @@ func resourceNetAppVolumeUpdate(d *pluginsdk.ResourceData, meta interface{}) err } if d.HasChange("tags") { - shouldUpdate = true tagsRaw := d.Get("tags").(map[string]interface{}) update.Tags = tags.Expand(tagsRaw) } - if shouldUpdate { - if err = client.UpdateThenPoll(ctx, *id, update); err != nil { - return fmt.Errorf("updating %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 - if err := waitForVolumeCreateOrUpdate(ctx, client, *id); err != nil { - return err - } + // Wait for volume to complete update + if err := waitForVolumeCreateOrUpdate(ctx, client, *id); err != nil { + return err } return resourceNetAppVolumeRead(d, meta) @@ -777,6 +835,9 @@ 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) } + if err := d.Set("data_protection_backup_policy", flattenNetAppVolumeDataProtectionBackupPolicy(props.DataProtection)); err != nil { + return fmt.Errorf("setting `data_protection_backup_policy`: %+v", err) + } return tags.FlattenAndSet(d, model.Tags) } @@ -798,53 +859,121 @@ func resourceNetAppVolumeDelete(d *pluginsdk.ResourceData, meta interface{}) err return fmt.Errorf("fetching netapp error: %+v", err) } + // Preventing unintentional severe data loss + if meta.(*clients.Client).Features.NetApp.PreventVolumeDestruction { + return fmt.Errorf("deleting NetApp Volume %q (Resource Group %q) is not allowed due to prevent_volume_destruction feature flag", id.VolumeName, id.ResourceGroupName) + } + + // Handling DataProtection if netApp.Model != nil && netApp.Model.Properties.DataProtection != nil { - dataProtectionReplication := netApp.Model.Properties.DataProtection - replicaVolumeId, err := volumesreplication.ParseVolumeID(id.ID()) - if err != nil { - return err - } - if dataProtectionReplication.Replication != nil && 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 = volumesreplication.ParseVolumeID(dataProtectionReplication.Replication.RemoteVolumeResourceId) + // Handling Replication before volume deletion + if netApp.Model.Properties.DataProtection.Replication != nil { + dataProtectionReplication := netApp.Model.Properties.DataProtection + replicaVolumeId, err := volumesreplication.ParseVolumeID(id.ID()) if err != nil { return err } - } + if dataProtectionReplication.Replication != nil && dataProtectionReplication.Replication.EndpointType != nil && !(strings.EqualFold(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 = volumesreplication.ParseVolumeID(dataProtectionReplication.Replication.RemoteVolumeResourceId) + if err != nil { + return err + } + } - replicationClient := meta.(*clients.Client).NetApp.VolumeReplicationClient - // Checking replication status before deletion, it needs to be broken before proceeding with deletion - if res, err := replicationClient.VolumesReplicationStatus(ctx, *replicaVolumeId); err == nil { - // Wait for replication state = "mirrored" - 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) + replicationClient := meta.(*clients.Client).NetApp.VolumeReplicationClient + // Checking replication status before deletion, it needs to be broken before proceeding with deletion + if res, err := replicationClient.VolumesReplicationStatus(ctx, *replicaVolumeId); err == nil { + // Wait for replication state = "mirrored" + 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 + 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, replicationClient, *replicaVolumeId, "broken"); err != nil { + return fmt.Errorf("waiting for the breaking of replication for %s: %+v", *replicaVolumeId, err) + } } - // Breaking replication - if err = replicationClient.VolumesBreakReplicationThenPoll(ctx, *replicaVolumeId, volumesreplication.BreakReplicationRequest{ - ForceBreakReplication: utils.Bool(true), - }); err != nil { - return fmt.Errorf("breaking replication for %s: %+v", *replicaVolumeId, err) + // Deleting replication and waiting for it to fully complete the operation + if _, err = replicationClient.VolumesDeleteReplication(ctx, *replicaVolumeId); err != nil { + return fmt.Errorf("deleting replicate %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, replicationClient, *replicaVolumeId, "broken"); err != nil { - return fmt.Errorf("waiting for the breaking of replication for %s: %+v", *replicaVolumeId, err) + if err := waitForReplicationDeletion(ctx, replicationClient, *replicaVolumeId); err != nil { + return fmt.Errorf("waiting for the replica %s to be deleted: %+v", *replicaVolumeId, err) } } - // Deleting replication and waiting for it to fully complete the operation - if _, err = replicationClient.VolumesDeleteReplication(ctx, *replicaVolumeId); err != nil { - return fmt.Errorf("deleting replicate %s: %+v", *replicaVolumeId, err) - } + // Handling Backup before volume deletion + if netApp.Model.Properties.DataProtection.Backup != nil { + dataProtectionBackup := netApp.Model.Properties.DataProtection + + if dataProtectionBackup.Backup != nil { + // Checking if initial backup is in progress + volumeIdFromBackupClient := backups.NewVolumeID(id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName) + backupClient := meta.(*clients.Client).NetApp.BackupClient + if err = waitForBackupRelationshipStateForDeletion(ctx, backupClient, volumeIdFromBackupClient); err != nil { + return fmt.Errorf("waiting for of %s: %+v", *id, err) + } + + // Disabling backup policy first, PolicyEnforced and BackupPolicyId can't be sent together + disableBackupPolicy := volumes.VolumePatch{ + Properties: &volumes.VolumePatchProperties{ + DataProtection: &volumes.VolumePatchPropertiesDataProtection{ + Backup: &volumes.VolumeBackupProperties{ + PolicyEnforced: utils.Bool(false), + }, + }, + }, + } + + if err = client.UpdateThenPoll(ctx, *id, disableBackupPolicy); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + // Wait for volume to complete update + if err := waitForVolumeCreateOrUpdate(ctx, client, *id); err != nil { + return err + } + + // Checking again if backup is in progress + if err = waitForBackupRelationshipStateForDeletion(ctx, backupClient, volumeIdFromBackupClient); err != nil { + return fmt.Errorf("waiting for of %s: %+v", *id, err) + } - if err := waitForReplicationDeletion(ctx, replicationClient, *replicaVolumeId); err != nil { - return fmt.Errorf("waiting for the replica %s to be deleted: %+v", *replicaVolumeId, err) + // Removing BackupPolicyId + backupPolicyIdRemoval := volumes.VolumePatch{ + Properties: &volumes.VolumePatchProperties{ + DataProtection: &volumes.VolumePatchPropertiesDataProtection{ + Backup: &volumes.VolumeBackupProperties{ + BackupPolicyId: pointer.To(""), + }, + }, + }, + } + + if err = client.UpdateThenPoll(ctx, *id, backupPolicyIdRemoval); err != nil { + return fmt.Errorf("updating %s: %+v", id, err) + } + + // Wait for volume to complete update + if err := waitForVolumeCreateOrUpdate(ctx, client, *id); err != nil { + return err + } + } } } @@ -1049,7 +1178,7 @@ func flattenNetAppVolumeDataProtectionReplication(input *volumes.VolumePropertie return []interface{}{} } - if strings.ToLower(string(*input.Replication.EndpointType)) == "" || strings.ToLower(string(*input.Replication.EndpointType)) != "dst" { + if strings.ToLower(string(*input.Replication.EndpointType)) == "" || !(strings.EqualFold(string(*input.Replication.EndpointType), "dst")) { return []interface{}{} } @@ -1079,3 +1208,33 @@ func flattenNetAppVolumeDataProtectionSnapshotPolicy(input *volumes.VolumeProper }, } } + +func flattenNetAppVolumeDataProtectionBackupPolicy(input *volumes.VolumePropertiesDataProtection) []interface{} { + if input == nil || input.Backup == nil { + return []interface{}{} + } + + backupPolicyID := "" + policyEnforced := false + backupVaultID := "" + + if input.Backup.BackupPolicyId != nil { + backupPolicyID = pointer.From(input.Backup.BackupPolicyId) + } + + if input.Backup.PolicyEnforced != nil { + policyEnforced = pointer.From(input.Backup.PolicyEnforced) + } + + if input.Backup.BackupVaultId != nil { + backupVaultID = pointer.From(input.Backup.BackupVaultId) + } + + return []interface{}{ + map[string]interface{}{ + "backup_policy_id": backupPolicyID, + "policy_enabled": policyEnforced, + "backup_vault_id": backupVaultID, + }, + } +} diff --git a/internal/services/netapp/netapp_volume_resource_test.go b/internal/services/netapp/netapp_volume_resource_test.go index 67741b47f512..01b05f92dd38 100644 --- a/internal/services/netapp/netapp_volume_resource_test.go +++ b/internal/services/netapp/netapp_volume_resource_test.go @@ -10,7 +10,7 @@ import ( "regexp" "testing" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-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" @@ -35,16 +35,37 @@ func TestAccNetAppVolume_basic(t *testing.T) { }) } -func TestAccNetAppVolume_smbEncryption(t *testing.T) { +func TestAccNetAppVolume_backupPolicy(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_netapp_volume", "test") r := NetAppVolumeResource{} data.ResourceTest(t, r, []acceptance.TestStep{ { - Config: r.smbEncryption(data), + Config: r.backupPolicy(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccNetAppVolume_backupPolicyUpdate(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_netapp_volume", "test") + r := NetAppVolumeResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.backupPolicy(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.updateBackupPolicy(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), - check.That(data.ResourceName).Key("smb3_protocol_encryption_enabled").HasValue("true"), ), }, data.ImportStep(), @@ -498,49 +519,118 @@ resource "azurerm_netapp_volume" "test" { `, cmkUserAssginedTemplate, networkTemplate, data.RandomInteger) } -func (NetAppVolumeResource) basic(data acceptance.TestData) string { +func (NetAppVolumeResource) backupPolicy(data acceptance.TestData) string { template := NetAppVolumeResource{}.template(data) return fmt.Sprintf(` -%s +%[1]s + +resource "azurerm_netapp_backup_vault" "test" { + name = "acctest-NetAppBackupVault-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + + tags = { + "testTag" = "testTagValue" + } +} + +resource "azurerm_netapp_backup_policy" "test" { + name = "acctest-NetAppBackupPolicy-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + daily_backups_to_keep = 2 + weekly_backups_to_keep = 2 + monthly_backups_to_keep = 2 + enabled = true +} resource "azurerm_netapp_volume" "test" { - name = "acctest-NetAppVolume-%d" + name = "acctest-NetAppVolume-%[2]d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name account_name = azurerm_netapp_account.test.name pool_name = azurerm_netapp_pool.test.name - volume_path = "my-unique-file-path-%d" + volume_path = "my-unique-file-path-%[2]d" service_level = "Standard" subnet_id = azurerm_subnet.test.id storage_quota_in_gb = 100 - throughput_in_mibps = 1.562 + throughput_in_mibps = 10 + + data_protection_backup_policy { + backup_vault_id = azurerm_netapp_backup_vault.test.id + backup_policy_id = azurerm_netapp_backup_policy.test.id + policy_enabled = true + } +} +`, template, data.RandomInteger) +} + +func (NetAppVolumeResource) updateBackupPolicy(data acceptance.TestData) string { + template := NetAppVolumeResource{}.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_netapp_backup_vault" "test" { + name = "acctest-NetAppBackupVault-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name tags = { - "CreatedOnDate" = "2022-07-08T23:50:21Z", - "SkipASMAzSecPack" = "true" + "testTag" = "testTagValue" } } -`, template, data.RandomInteger, data.RandomInteger) + +resource "azurerm_netapp_backup_policy" "test" { + name = "acctest-NetAppBackupPolicy-%[2]d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + account_name = azurerm_netapp_account.test.name + daily_backups_to_keep = 2 + weekly_backups_to_keep = 2 + monthly_backups_to_keep = 2 + enabled = true } -func (NetAppVolumeResource) smbEncryption(data acceptance.TestData) string { - template := NetAppVolumeResource{}.templateSmbEncryption(data) +resource "azurerm_netapp_volume" "test" { + name = "acctest-NetAppVolume-%[2]d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_name = azurerm_netapp_account.test.name + pool_name = azurerm_netapp_pool.test.name + volume_path = "my-unique-file-path-%[2]d" + service_level = "Standard" + subnet_id = azurerm_subnet.test.id + storage_quota_in_gb = 100 + throughput_in_mibps = 10 + + data_protection_backup_policy { + backup_vault_id = azurerm_netapp_backup_vault.test.id + backup_policy_id = azurerm_netapp_backup_policy.test.id + policy_enabled = false + } +} +`, template, data.RandomInteger) +} + +func (NetAppVolumeResource) basic(data acceptance.TestData) string { + template := NetAppVolumeResource{}.template(data) return fmt.Sprintf(` %s resource "azurerm_netapp_volume" "test" { - name = "acctest-NetAppVolume-smbencryption-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - account_name = azurerm_netapp_account.test.name - pool_name = azurerm_netapp_pool.test.name - volume_path = "my-unique-file-path-%d" - service_level = "Standard" - subnet_id = azurerm_subnet.test.id - storage_quota_in_gb = 100 - throughput_in_mibps = 1.562 - protocols = ["CIFS"] - smb3_protocol_encryption_enabled = true + name = "acctest-NetAppVolume-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + account_name = azurerm_netapp_account.test.name + pool_name = azurerm_netapp_pool.test.name + volume_path = "my-unique-file-path-%d" + service_level = "Standard" + subnet_id = azurerm_subnet.test.id + storage_quota_in_gb = 100 + throughput_in_mibps = 1.562 tags = { "CreatedOnDate" = "2022-07-08T23:50:21Z", @@ -700,7 +790,7 @@ resource "azurerm_netapp_volume" "test_primary" { subnet_id = azurerm_subnet.test.id protocols = ["NFSv3"] storage_quota_in_gb = 100 - snapshot_directory_visible = false + snapshot_directory_visible = true throughput_in_mibps = 1.562 export_policy_rule { @@ -728,7 +818,7 @@ resource "azurerm_netapp_volume" "test_secondary" { subnet_id = azurerm_subnet.test_secondary.id protocols = ["NFSv3"] storage_quota_in_gb = 100 - snapshot_directory_visible = false + snapshot_directory_visible = true throughput_in_mibps = 1.562 export_policy_rule { @@ -1203,111 +1293,9 @@ resource "azurerm_netapp_pool" "test_secondary" { `, r.template(data), data.RandomInteger, "eastus2") } -func (NetAppVolumeResource) templateSmbEncryption(data acceptance.TestData) string { - return fmt.Sprintf(` -provider "azurerm" { - alias = "all1" - features { - resource_group { - prevent_deletion_if_contains_resources = false - } - } -} - -resource "azurerm_resource_group" "test" { - name = "acctestRG-netapp-%d" - location = "%s" - - tags = { - "CreatedOnDate" = "2022-07-08T23:50:21Z", - "SkipASMAzSecPack" = "true", - "SkipNRMSNSG" = "true" - } -} - -resource "azurerm_virtual_network" "test" { - name = "acctest-VirtualNetwork-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - address_space = ["10.6.0.0/16"] - - tags = { - "CreatedOnDate" = "2022-07-08T23:50:21Z", - "SkipASMAzSecPack" = "true" - } -} - -resource "azurerm_subnet" "test" { - name = "acctest-Subnet-%d" - resource_group_name = azurerm_resource_group.test.name - virtual_network_name = azurerm_virtual_network.test.name - address_prefixes = ["10.6.2.0/24"] - - delegation { - name = "testdelegation" - - service_delegation { - name = "Microsoft.Netapp/volumes" - actions = ["Microsoft.Network/networkinterfaces/*", "Microsoft.Network/virtualNetworks/subnets/join/action"] - } - } -} - -resource "azurerm_netapp_account" "test" { - name = "acctest-NetAppAccount-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - - active_directory { - username = "aduser" - password = "aduserpwd" - smb_server_name = "SMB-SERVER" - dns_servers = ["1.2.3.4", "1.2.3.5"] - domain = "westcentralus.com" - organizational_unit = "OU=FirstLevel" - site_name = "My-Site-Name" - kerberos_ad_name = "My-AD-Server" - kerberos_kdc_ip = "192.168.1.1" - aes_encryption_enabled = true - local_nfs_users_with_ldap_allowed = true - ldap_over_tls_enabled = true - server_root_ca_certificate = "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNZekNDQWN5Z0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREF1TVFzd0NRWURWUVFHRXdKVlV6RU0gCk1Bb0dBMVVFQ2hNRFNVSk5NUkV3RHdZRFZRUUxFd2hNYjJOaGJDQkRRVEFlRncwNU9URXlNakl3TlRBd01EQmEgCkZ3MHdNREV5TWpNd05EVTVOVGxhTUM0eEN6QUpCZ05WQkFZVEFsVlRNUXd3Q2dZRFZRUUtFd05KUWsweEVUQVAgCkJnTlZCQXNUQ0V4dlkyRnNJRU5CTUlHZk1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTkFEQ0JpUUtCZ1FEMmJaRW8gCjd4R2FYMi8wR0hrck5GWnZseEJvdTl2MUptdC9QRGlUTVB2ZThyOUZlSkFRMFFkdkZTVC8wSlBRWUQyMHJIMGIgCmltZERMZ05kTnlubXlSb1MyUy9JSW5mcG1mNjlpeWMyRzBUUHlSdm1ISWlPWmJkQ2QrWUJIUWkxYWRrajE3TkQgCmNXajZTMTR0VnVyRlg3M3p4MHNOb01TNzlxM3R1WEtyRHN4ZXV3SURBUUFCbzRHUU1JR05NRXNHQ1ZVZER3R0cgCitFSUJEUVErRXp4SFpXNWxjbUYwWldRZ1lua2dkR2hsSUZObFkzVnlaVmRoZVNCVFpXTjFjbWwwZVNCVFpYSjIgClpYSWdabTl5SUU5VEx6TTVNQ0FvVWtGRFJpa3dEZ1lEVlIwUEFRSC9CQVFEQWdBR01BOEdBMVVkRXdFQi93UUYgCk1BTUJBZjh3SFFZRFZSME9CQllFRkozK29jUnlDVEp3MDY3ZExTd3IvbmFseDZZTU1BMEdDU3FHU0liM0RRRUIgCkJRVUFBNEdCQU1hUXp0K3phajFHVTc3eXpscjhpaU1CWGdkUXJ3c1paV0pvNWV4bkF1Y0pBRVlRWm1PZnlMaU0gCkQ2b1lxK1puZnZNMG44Ry9ZNzlxOG5od3Z1eHBZT25SU0FYRnA2eFNrcklPZVp0Sk1ZMWgwMExLcC9KWDNOZzEgCnN2WjJhZ0UxMjZKSHNRMGJoek41VEtzWWZid2ZUd2ZqZFdBR3k2VmYxbllpL3JPK3J5TU8KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLSA=" - ldap_signing_enabled = true - } - - tags = { - "CreatedOnDate" = "2022-07-08T23:50:21Z", - "SkipASMAzSecPack" = "true" - } -} - -resource "azurerm_netapp_pool" "test" { - name = "acctest-NetAppPool-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - account_name = azurerm_netapp_account.test.name - service_level = "Standard" - size_in_tb = 4 - qos_type = "Manual" - - tags = { - "CreatedOnDate" = "2022-07-08T23:50:21Z", - "SkipASMAzSecPack" = "true" - } -} -`, data.RandomInteger, "westeurope", data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) -} - -func (NetAppVolumeResource) template(data acceptance.TestData) string { +func (r NetAppVolumeResource) template(data acceptance.TestData) string { return fmt.Sprintf(` -provider "azurerm" { - alias = "all1" - features { - resource_group { - prevent_deletion_if_contains_resources = false - } - } -} +%s resource "azurerm_resource_group" "test" { name = "acctestRG-netapp-%d" @@ -1373,19 +1361,12 @@ resource "azurerm_netapp_pool" "test" { "SkipASMAzSecPack" = "true" } } -`, data.RandomInteger, "westus2", data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) +`, r.templateProviderFeatureFlags(), data.RandomInteger, "westus2", data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) } -func (NetAppVolumeResource) templatePoolQosManual(data acceptance.TestData) string { +func (r NetAppVolumeResource) templatePoolQosManual(data acceptance.TestData) string { return fmt.Sprintf(` -provider "azurerm" { - alias = "all2" - features { - resource_group { - prevent_deletion_if_contains_resources = false - } - } -} +%s resource "azurerm_resource_group" "test" { name = "acctestRG-netapp-%d" @@ -1463,13 +1444,15 @@ resource "azurerm_netapp_pool" "test" { "SkipASMAzSecPack" = "true" } } -`, data.RandomInteger, "westus2", data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) +`, r.templateProviderFeatureFlags(), data.RandomInteger, "westus2", data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger, data.RandomInteger) } -func (NetAppVolumeResource) networkTemplate(data acceptance.TestData) string { +func (r NetAppVolumeResource) networkTemplate(data acceptance.TestData) string { return fmt.Sprintf(` +%[1]s + resource "azurerm_virtual_network" "test" { - name = "acctest-VirtualNetwork-%[1]d" + name = "acctest-VirtualNetwork-%[2]d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name address_space = ["10.6.0.0/16"] @@ -1481,7 +1464,7 @@ resource "azurerm_virtual_network" "test" { } resource "azurerm_subnet" "test-delegated" { - name = "acctest-Delegated-Subnet-%[1]d" + name = "acctest-Delegated-Subnet-%[2]d" resource_group_name = azurerm_resource_group.test.name virtual_network_name = azurerm_virtual_network.test.name address_prefixes = ["10.6.1.0/24"] @@ -1497,10 +1480,26 @@ resource "azurerm_subnet" "test-delegated" { } resource "azurerm_subnet" "test-non-delegated" { - name = "acctest-Non-Delegated-Subnet-%[1]d" + name = "acctest-Non-Delegated-Subnet-%[2]d" resource_group_name = azurerm_resource_group.test.name virtual_network_name = azurerm_virtual_network.test.name address_prefixes = ["10.6.0.0/24"] } -`, data.RandomInteger) +`, r.templateProviderFeatureFlags(), data.RandomInteger) +} + +func (NetAppVolumeResource) templateProviderFeatureFlags() string { + return ` +provider "azurerm" { + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + netapp { + prevent_volume_destruction = false + delete_backups_on_backup_vault_destroy = true + } + } +} +` } diff --git a/internal/services/netapp/registration.go b/internal/services/netapp/registration.go index cf758c73f21c..9b0e86bee0e8 100644 --- a/internal/services/netapp/registration.go +++ b/internal/services/netapp/registration.go @@ -55,6 +55,8 @@ func (r Registration) DataSources() []sdk.DataSource { NetAppVolumeGroupSapHanaDataSource{}, NetAppVolumeQuotaRuleDataSource{}, NetAppAccountEncryptionDataSource{}, + NetAppBackupVaultDataSource{}, + NetAppBackupPolicyDataSource{}, } } @@ -64,5 +66,7 @@ func (r Registration) Resources() []sdk.Resource { NetAppVolumeGroupSapHanaResource{}, NetAppVolumeQuotaRuleResource{}, NetAppAccountEncryptionResource{}, + NetAppBackupVaultResource{}, + NetAppBackupPolicyResource{}, } } diff --git a/internal/services/netapp/validate/account_id.go b/internal/services/netapp/validate/account_id.go index 9d204ef701d8..b9dfdb5d7551 100644 --- a/internal/services/netapp/validate/account_id.go +++ b/internal/services/netapp/validate/account_id.go @@ -6,7 +6,7 @@ package validate import ( "fmt" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" ) func ValidateNetAppAccountID(input interface{}, key string) (warnings []string, errors []error) { diff --git a/internal/services/netapp/validate/backup_policy_validation.go b/internal/services/netapp/validate/backup_policy_validation.go new file mode 100644 index 000000000000..b25bbc905f0b --- /dev/null +++ b/internal/services/netapp/validate/backup_policy_validation.go @@ -0,0 +1,34 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +import ( + "fmt" +) + +const ( + maximumAllowedCombinedRetentionCount = 1019 +) + +func ValidateNetAppBackupPolicyCombinedRetention(dailyBackupsToKeep, weeklyBackupsToKeep, monthlyBackupsToKeep int64) []error { + errors := make([]error, 0) + + // Validates that the combined retention count is less than the maximum allowed + if dailyBackupsToKeep+weeklyBackupsToKeep+monthlyBackupsToKeep > maximumAllowedCombinedRetentionCount { + errors = append(errors, fmt.Errorf("the combined retention count of daily_backups_to_keep, weekly_backups_to_keep, and monthly_backups_to_keep must be less than or equal to %d", maximumAllowedCombinedRetentionCount)) + } + + return errors +} + +// TODO: Validating that the policy attached to a secondary CRR volume (destination) is not enabled for backup +func ValidateNetAppBackupPolicyForSecondaryCRRVolume(backupPolicyEnabled bool) []error { + errors := make([]error, 0) + + if backupPolicyEnabled { + errors = append(errors, fmt.Errorf("backup policy cannot be enabled on a secondary CRR volume")) + } + + return errors +} diff --git a/internal/services/netapp/validate/backup_policy_validation_test.go b/internal/services/netapp/validate/backup_policy_validation_test.go new file mode 100644 index 000000000000..132db1def2df --- /dev/null +++ b/internal/services/netapp/validate/backup_policy_validation_test.go @@ -0,0 +1,58 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy" +) + +const ( + minDataDailyBackupsToKeep int64 = 10 + minDataWeeklyBackupsToKeep int64 = 10 + minDataMonthlyBackupsToKeep int64 = 10 + + maxDataDailyBackupsToKeep int64 = 1019 + maxDataWeeklyBackupsToKeep int64 = 1019 + maxDataMonthlyBackupsToKeep int64 = 1019 +) + +func TestValidateNetAppBackupPolicyCombinedRetention(t *testing.T) { + cases := []struct { + Name string + BackupPolicyData backuppolicy.BackupPolicyProperties + Errors int + }{ + { + Name: "ValidateCombinedRetentionWithValidValues", + BackupPolicyData: backuppolicy.BackupPolicyProperties{ + DailyBackupsToKeep: pointer.To(minDataDailyBackupsToKeep), + WeeklyBackupsToKeep: pointer.To(minDataWeeklyBackupsToKeep), + MonthlyBackupsToKeep: pointer.To(minDataMonthlyBackupsToKeep), + }, + Errors: 0, + }, + { + Name: "ValidateCombinedRetentionWithValidValuesMaximumReachedFailure", + BackupPolicyData: backuppolicy.BackupPolicyProperties{ + DailyBackupsToKeep: pointer.To(maxDataDailyBackupsToKeep), + WeeklyBackupsToKeep: pointer.To(maxDataWeeklyBackupsToKeep), + MonthlyBackupsToKeep: pointer.To(maxDataMonthlyBackupsToKeep), + }, + Errors: 1, + }, + } + + for _, tc := range cases { + t.Run(tc.Name, func(t *testing.T) { + errors := ValidateNetAppBackupPolicyCombinedRetention(pointer.From(tc.BackupPolicyData.DailyBackupsToKeep), pointer.From(tc.BackupPolicyData.WeeklyBackupsToKeep), pointer.From(tc.BackupPolicyData.MonthlyBackupsToKeep)) + + if len(errors) != tc.Errors { + t.Fatalf("expected ValidateUnixUserIDOrGroupID to return %d error(s) not %d\nError List: \n%v", tc.Errors, len(errors), errors) + } + }) + } +} diff --git a/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation.go b/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation.go index 93a930c7e701..1adfea70124e 100644 --- a/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation.go +++ b/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" ) func ValidateNetAppVolumeGroupExportPolicyRuleSAPHanna(rule volumegroups.ExportPolicyRule, protocolType string) []error { diff --git a/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation_test.go b/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation_test.go index dfebadc3ac4e..c2416e3d8aca 100644 --- a/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation_test.go +++ b/internal/services/netapp/validate/volume_group_sap_hana_volumes_export_policy_validation_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation.go b/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation.go index 20ea71559376..be863b92a9b8 100644 --- a/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation.go +++ b/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" ) type VolumeSpecNameSapHana string diff --git a/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation_test.go b/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation_test.go index af1a109d8b0c..a01d28537ac9 100644 --- a/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation_test.go +++ b/internal/services/netapp/validate/volume_group_sap_hana_volumes_validation_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" "github.com/hashicorp/terraform-provider-azurerm/utils" ) diff --git a/internal/services/netapp/validate/volume_quota_rule_quota_target_id_unix_validation_test.go b/internal/services/netapp/validate/volume_quota_rule_quota_target_id_unix_validation_test.go index 884db310776f..51fcf816d33d 100644 --- a/internal/services/netapp/validate/volume_quota_rule_quota_target_id_unix_validation_test.go +++ b/internal/services/netapp/validate/volume_quota_rule_quota_target_id_unix_validation_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" ) func TestValidateNetAppVolumeQuotaRulesUnix(t *testing.T) { diff --git a/internal/services/netapp/validate/volume_quota_rule_quota_target_id_windows_validation_test.go b/internal/services/netapp/validate/volume_quota_rule_quota_target_id_windows_validation_test.go index fc52132d24f8..67f2a92c9f6f 100644 --- a/internal/services/netapp/validate/volume_quota_rule_quota_target_id_windows_validation_test.go +++ b/internal/services/netapp/validate/volume_quota_rule_quota_target_id_windows_validation_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" ) func TestValidateNetAppVolumeQuotaRules(t *testing.T) { diff --git a/internal/services/netapp/validate/volume_quota_rule_quota_target_validation_test.go b/internal/services/netapp/validate/volume_quota_rule_quota_target_validation_test.go index ed72508569b8..7f5df51f0306 100644 --- a/internal/services/netapp/validate/volume_quota_rule_quota_target_validation_test.go +++ b/internal/services/netapp/validate/volume_quota_rule_quota_target_validation_test.go @@ -7,7 +7,7 @@ import ( "testing" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" ) func TestValidateNetAppVolumeQuotaRulesQuotaType(t *testing.T) { diff --git a/internal/services/netapp/validate/volume_quota_rule_quota_validations.go b/internal/services/netapp/validate/volume_quota_rule_quota_validations.go index 61b39b0606e3..3f388d7555c4 100644 --- a/internal/services/netapp/validate/volume_quota_rule_quota_validations.go +++ b/internal/services/netapp/validate/volume_quota_rule_quota_validations.go @@ -9,8 +9,8 @@ import ( "net/http" "github.com/hashicorp/go-azure-helpers/lang/pointer" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" + "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" "github.com/hashicorp/terraform-provider-azurerm/internal/clients" netAppModels "github.com/hashicorp/terraform-provider-azurerm/internal/services/netapp/models" ) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/README.md new file mode 100644 index 000000000000..2d3e5eda7664 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy` Documentation + +The `backuppolicy` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2024-03-01/backuppolicy" +``` + + +### Client Initialization + +```go +client := backuppolicy.NewBackupPolicyClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupPolicyClient.BackupPoliciesCreate` + +```go +ctx := context.TODO() +id := backuppolicy.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupPolicyName") + +payload := backuppolicy.BackupPolicy{ + // ... +} + + +if err := client.BackupPoliciesCreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupPolicyClient.BackupPoliciesDelete` + +```go +ctx := context.TODO() +id := backuppolicy.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupPolicyName") + +if err := client.BackupPoliciesDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupPolicyClient.BackupPoliciesGet` + +```go +ctx := context.TODO() +id := backuppolicy.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupPolicyName") + +read, err := client.BackupPoliciesGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupPolicyClient.BackupPoliciesList` + +```go +ctx := context.TODO() +id := backuppolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName") + +read, err := client.BackupPoliciesList(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupPolicyClient.BackupPoliciesUpdate` + +```go +ctx := context.TODO() +id := backuppolicy.NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupPolicyName") + +payload := backuppolicy.BackupPolicyPatch{ + // ... +} + + +if err := client.BackupPoliciesUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/client.go new file mode 100644 index 000000000000..8b4fc07ad66e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/client.go @@ -0,0 +1,26 @@ +package backuppolicy + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPolicyClient struct { + Client *resourcemanager.Client +} + +func NewBackupPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*BackupPolicyClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "backuppolicy", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) + } + + return &BackupPolicyClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/id_backuppolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/id_backuppolicy.go new file mode 100644 index 000000000000..7e2cd95f2103 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/id_backuppolicy.go @@ -0,0 +1,139 @@ +package backuppolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&BackupPolicyId{}) +} + +var _ resourceids.ResourceId = &BackupPolicyId{} + +// BackupPolicyId is a struct representing the Resource ID for a Backup Policy +type BackupPolicyId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string + BackupPolicyName string +} + +// NewBackupPolicyID returns a new BackupPolicyId struct +func NewBackupPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, backupPolicyName string) BackupPolicyId { + return BackupPolicyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + BackupPolicyName: backupPolicyName, + } +} + +// ParseBackupPolicyID parses 'input' into a BackupPolicyId +func ParseBackupPolicyID(input string) (*BackupPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupPolicyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupPolicyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBackupPolicyIDInsensitively parses 'input' case-insensitively into a BackupPolicyId +// note: this method should only be used for API response data and not user input +func ParseBackupPolicyIDInsensitively(input string) (*BackupPolicyId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupPolicyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupPolicyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupPolicyId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + if id.BackupPolicyName, ok = input.Parsed["backupPolicyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupPolicyName", input) + } + + return nil +} + +// ValidateBackupPolicyID checks that 'input' can be parsed as a Backup Policy ID +func ValidateBackupPolicyID(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 := ParseBackupPolicyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Policy ID +func (id BackupPolicyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/backupPolicies/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.BackupPolicyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Policy ID +func (id BackupPolicyId) 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("netAppAccountName", "netAppAccountName"), + resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), + resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyName"), + } +} + +// String returns a human-readable description of this Backup Policy ID +func (id BackupPolicyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Backup Policy Name: %q", id.BackupPolicyName), + } + return fmt.Sprintf("Backup Policy (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/id_netappaccount.go new file mode 100644 index 000000000000..b10e89e1ad13 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/id_netappaccount.go @@ -0,0 +1,130 @@ +package backuppolicy + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&NetAppAccountId{}) +} + +var _ resourceids.ResourceId = &NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, netAppAccountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + } +} + +// 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) + } + + id := NetAppAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + 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) + } + + id := NetAppAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetAppAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + return 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.NetAppAccountName) +} + +// 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("netAppAccountName", "netAppAccountName"), + } +} + +// 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("Net App Account Name: %q", id.NetAppAccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciescreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciescreate.go new file mode 100644 index 000000000000..bb886f447546 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciescreate.go @@ -0,0 +1,76 @@ +package backuppolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesCreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BackupPolicy +} + +// BackupPoliciesCreate ... +func (c BackupPolicyClient) BackupPoliciesCreate(ctx context.Context, id BackupPolicyId, input BackupPolicy) (result BackupPoliciesCreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BackupPoliciesCreateThenPoll performs BackupPoliciesCreate then polls until it's completed +func (c BackupPolicyClient) BackupPoliciesCreateThenPoll(ctx context.Context, id BackupPolicyId, input BackupPolicy) error { + result, err := c.BackupPoliciesCreate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BackupPoliciesCreate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BackupPoliciesCreate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesdelete.go new file mode 100644 index 000000000000..482cdc1780e3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesdelete.go @@ -0,0 +1,71 @@ +package backuppolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesDeleteOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// BackupPoliciesDelete ... +func (c BackupPolicyClient) BackupPoliciesDelete(ctx context.Context, id BackupPolicyId) (result BackupPoliciesDeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BackupPoliciesDeleteThenPoll performs BackupPoliciesDelete then polls until it's completed +func (c BackupPolicyClient) BackupPoliciesDeleteThenPoll(ctx context.Context, id BackupPolicyId) error { + result, err := c.BackupPoliciesDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing BackupPoliciesDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BackupPoliciesDelete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesget.go new file mode 100644 index 000000000000..e8ecfc1fc044 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesget.go @@ -0,0 +1,53 @@ +package backuppolicy + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackupPolicy +} + +// BackupPoliciesGet ... +func (c BackupPolicyClient) BackupPoliciesGet(ctx context.Context, id BackupPolicyId) (result BackupPoliciesGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model BackupPolicy + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppolicieslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppolicieslist.go new file mode 100644 index 000000000000..7932d9642408 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppolicieslist.go @@ -0,0 +1,54 @@ +package backuppolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackupPoliciesList +} + +// BackupPoliciesList ... +func (c BackupPolicyClient) BackupPoliciesList(ctx context.Context, id NetAppAccountId) (result BackupPoliciesListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/backupPolicies", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model BackupPoliciesList + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesupdate.go new file mode 100644 index 000000000000..b24e23a21cf1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/method_backuppoliciesupdate.go @@ -0,0 +1,75 @@ +package backuppolicy + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BackupPolicy +} + +// BackupPoliciesUpdate ... +func (c BackupPolicyClient) BackupPoliciesUpdate(ctx context.Context, id BackupPolicyId, input BackupPolicyPatch) (result BackupPoliciesUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// BackupPoliciesUpdateThenPoll performs BackupPoliciesUpdate then polls until it's completed +func (c BackupPolicyClient) BackupPoliciesUpdateThenPoll(ctx context.Context, id BackupPolicyId, input BackupPolicyPatch) error { + result, err := c.BackupPoliciesUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing BackupPoliciesUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after BackupPoliciesUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicieslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicieslist.go new file mode 100644 index 000000000000..3db3d131a60e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicieslist.go @@ -0,0 +1,8 @@ +package backuppolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPoliciesList struct { + Value *[]BackupPolicy `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicy.go new file mode 100644 index 000000000000..747ab65be24b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicy.go @@ -0,0 +1,19 @@ +package backuppolicy + +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 BackupPolicy struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties BackupPolicyProperties `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/2024-03-01/backuppolicy/model_backuppolicypatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicypatch.go new file mode 100644 index 000000000000..bf7eecb1358e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicypatch.go @@ -0,0 +1,13 @@ +package backuppolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPolicyPatch struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *BackupPolicyProperties `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/2024-03-01/backuppolicy/model_backuppolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicyproperties.go new file mode 100644 index 000000000000..d5694f4797d5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_backuppolicyproperties.go @@ -0,0 +1,15 @@ +package backuppolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPolicyProperties struct { + BackupPolicyId *string `json:"backupPolicyId,omitempty"` + DailyBackupsToKeep *int64 `json:"dailyBackupsToKeep,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + MonthlyBackupsToKeep *int64 `json:"monthlyBackupsToKeep,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + VolumeBackups *[]VolumeBackups `json:"volumeBackups,omitempty"` + VolumesAssigned *int64 `json:"volumesAssigned,omitempty"` + WeeklyBackupsToKeep *int64 `json:"weeklyBackupsToKeep,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_volumebackups.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_volumebackups.go new file mode 100644 index 000000000000..b53afb9ae148 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/model_volumebackups.go @@ -0,0 +1,11 @@ +package backuppolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VolumeBackups struct { + BackupsCount *int64 `json:"backupsCount,omitempty"` + PolicyEnabled *bool `json:"policyEnabled,omitempty"` + VolumeName *string `json:"volumeName,omitempty"` + VolumeResourceId *string `json:"volumeResourceId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/version.go new file mode 100644 index 000000000000..b6697aad0a16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy/version.go @@ -0,0 +1,10 @@ +package backuppolicy + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-03-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/backuppolicy/2024-03-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/README.md new file mode 100644 index 000000000000..be38f5d3e723 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/README.md @@ -0,0 +1,166 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups` Documentation + +The `backups` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2024-03-01/backups" +``` + + +### Client Initialization + +```go +client := backups.NewBackupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupsClient.Create` + +```go +ctx := context.TODO() +id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName", "backupName") + +payload := backups.Backup{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupsClient.Delete` + +```go +ctx := context.TODO() +id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName", "backupName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupsClient.Get` + +```go +ctx := context.TODO() +id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName", "backupName") + +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: `BackupsClient.GetLatestStatus` + +```go +ctx := context.TODO() +id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "capacityPoolName", "volumeName") + +read, err := client.GetLatestStatus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `BackupsClient.ListByVault` + +```go +ctx := context.TODO() +id := backups.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName") + +// alternatively `client.ListByVault(ctx, id, backups.DefaultListByVaultOperationOptions())` can be used to do batched pagination +items, err := client.ListByVaultComplete(ctx, id, backups.DefaultListByVaultOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BackupsClient.UnderAccountMigrateBackups` + +```go +ctx := context.TODO() +id := backups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName") + +payload := backups.BackupsMigrationRequest{ + // ... +} + + +if err := client.UnderAccountMigrateBackupsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupsClient.UnderBackupVaultRestoreFiles` + +```go +ctx := context.TODO() +id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName", "backupName") + +payload := backups.BackupRestoreFiles{ + // ... +} + + +if err := client.UnderBackupVaultRestoreFilesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupsClient.UnderVolumeMigrateBackups` + +```go +ctx := context.TODO() +id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "capacityPoolName", "volumeName") + +payload := backups.BackupsMigrationRequest{ + // ... +} + + +if err := client.UnderVolumeMigrateBackupsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupsClient.Update` + +```go +ctx := context.TODO() +id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName", "backupName") + +payload := backups.BackupPatch{ + // ... +} + + +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/2024-03-01/backups/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/client.go new file mode 100644 index 000000000000..6e1cc70d4343 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/client.go @@ -0,0 +1,26 @@ +package backups + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupsClient struct { + Client *resourcemanager.Client +} + +func NewBackupsClientWithBaseURI(sdkApi sdkEnv.Api) (*BackupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "backups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) + } + + return &BackupsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/constants.go new file mode 100644 index 000000000000..d3c86cd75c04 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/constants.go @@ -0,0 +1,142 @@ +package backups + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupType string + +const ( + BackupTypeManual BackupType = "Manual" + BackupTypeScheduled BackupType = "Scheduled" +) + +func PossibleValuesForBackupType() []string { + return []string{ + string(BackupTypeManual), + string(BackupTypeScheduled), + } +} + +func (s *BackupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseBackupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseBackupType(input string) (*BackupType, error) { + vals := map[string]BackupType{ + "manual": BackupTypeManual, + "scheduled": BackupTypeScheduled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := BackupType(input) + return &out, nil +} + +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 (s *MirrorState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMirrorState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +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 ( + RelationshipStatusFailed RelationshipStatus = "Failed" + RelationshipStatusIdle RelationshipStatus = "Idle" + RelationshipStatusTransferring RelationshipStatus = "Transferring" + RelationshipStatusUnknown RelationshipStatus = "Unknown" +) + +func PossibleValuesForRelationshipStatus() []string { + return []string{ + string(RelationshipStatusFailed), + string(RelationshipStatusIdle), + string(RelationshipStatusTransferring), + string(RelationshipStatusUnknown), + } +} + +func (s *RelationshipStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRelationshipStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRelationshipStatus(input string) (*RelationshipStatus, error) { + vals := map[string]RelationshipStatus{ + "failed": RelationshipStatusFailed, + "idle": RelationshipStatusIdle, + "transferring": RelationshipStatusTransferring, + "unknown": RelationshipStatusUnknown, + } + 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/2024-03-01/backups/id_backup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_backup.go new file mode 100644 index 000000000000..06aacd5f5b51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_backup.go @@ -0,0 +1,148 @@ +package backups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&BackupId{}) +} + +var _ resourceids.ResourceId = &BackupId{} + +// BackupId is a struct representing the Resource ID for a Backup +type BackupId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string + BackupVaultName string + BackupName string +} + +// NewBackupID returns a new BackupId struct +func NewBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, backupVaultName string, backupName string) BackupId { + return BackupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + BackupVaultName: backupVaultName, + BackupName: backupName, + } +} + +// ParseBackupID parses 'input' into a BackupId +func ParseBackupID(input string) (*BackupId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBackupIDInsensitively parses 'input' case-insensitively into a BackupId +// note: this method should only be used for API response data and not user input +func ParseBackupIDInsensitively(input string) (*BackupId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) + } + + if id.BackupName, ok = input.Parsed["backupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupName", input) + } + + return nil +} + +// ValidateBackupID checks that 'input' can be parsed as a Backup ID +func ValidateBackupID(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 := ParseBackupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup ID +func (id BackupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/backupVaults/%s/backups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.BackupVaultName, id.BackupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup ID +func (id BackupId) 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("netAppAccountName", "netAppAccountName"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultName"), + resourceids.StaticSegment("staticBackups", "backups", "backups"), + resourceids.UserSpecifiedSegment("backupName", "backupName"), + } +} + +// String returns a human-readable description of this Backup ID +func (id BackupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), + fmt.Sprintf("Backup Name: %q", id.BackupName), + } + return fmt.Sprintf("Backup (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_backupvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_backupvault.go new file mode 100644 index 000000000000..779adf353ca9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_backupvault.go @@ -0,0 +1,139 @@ +package backups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&BackupVaultId{}) +} + +var _ resourceids.ResourceId = &BackupVaultId{} + +// BackupVaultId is a struct representing the Resource ID for a Backup Vault +type BackupVaultId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string + BackupVaultName string +} + +// NewBackupVaultID returns a new BackupVaultId struct +func NewBackupVaultID(subscriptionId string, resourceGroupName string, netAppAccountName string, backupVaultName string) BackupVaultId { + return BackupVaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + BackupVaultName: backupVaultName, + } +} + +// ParseBackupVaultID parses 'input' into a BackupVaultId +func ParseBackupVaultID(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBackupVaultIDInsensitively parses 'input' case-insensitively into a BackupVaultId +// note: this method should only be used for API response data and not user input +func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) + } + + return nil +} + +// ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID +func ValidateBackupVaultID(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 := ParseBackupVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Vault ID +func (id BackupVaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/backupVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.BackupVaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID +func (id BackupVaultId) 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("netAppAccountName", "netAppAccountName"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultName"), + } +} + +// String returns a human-readable description of this Backup Vault ID +func (id BackupVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), + } + return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_netappaccount.go new file mode 100644 index 000000000000..516c7ff39118 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_netappaccount.go @@ -0,0 +1,130 @@ +package backups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&NetAppAccountId{}) +} + +var _ resourceids.ResourceId = &NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, netAppAccountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + } +} + +// 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) + } + + id := NetAppAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + 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) + } + + id := NetAppAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetAppAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + return 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.NetAppAccountName) +} + +// 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("netAppAccountName", "netAppAccountName"), + } +} + +// 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("Net App Account Name: %q", id.NetAppAccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_volume.go new file mode 100644 index 000000000000..68f2aee4179e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/id_volume.go @@ -0,0 +1,148 @@ +package backups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VolumeId{}) +} + +var _ resourceids.ResourceId = &VolumeId{} + +// VolumeId is a struct representing the Resource ID for a Volume +type VolumeId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string + CapacityPoolName string + VolumeName string +} + +// NewVolumeID returns a new VolumeId struct +func NewVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string) VolumeId { + return VolumeId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + CapacityPoolName: capacityPoolName, + 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) + } + + id := VolumeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + 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) + } + + id := VolumeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VolumeId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + if id.CapacityPoolName, ok = input.Parsed["capacityPoolName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityPoolName", input) + } + + if id.VolumeName, ok = input.Parsed["volumeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "volumeName", input) + } + + return 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.NetAppAccountName, id.CapacityPoolName, 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("netAppAccountName", "netAppAccountName"), + resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), + resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolName"), + resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), + resourceids.UserSpecifiedSegment("volumeName", "volumeName"), + } +} + +// 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("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), + 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/2024-03-01/backups/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_create.go new file mode 100644 index 000000000000..547e1883e1f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_create.go @@ -0,0 +1,75 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Backup +} + +// Create ... +func (c BackupsClient) Create(ctx context.Context, id BackupId, input Backup) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateThenPoll performs Create then polls until it's completed +func (c BackupsClient) CreateThenPoll(ctx context.Context, id BackupId, input Backup) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_delete.go new file mode 100644 index 000000000000..15a40b88c3cf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_delete.go @@ -0,0 +1,70 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c BackupsClient) Delete(ctx context.Context, id BackupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c BackupsClient) DeleteThenPoll(ctx context.Context, id BackupId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_get.go new file mode 100644 index 000000000000..fe88bb84d0a4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_get.go @@ -0,0 +1,53 @@ +package backups + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *Backup +} + +// Get ... +func (c BackupsClient) Get(ctx context.Context, id BackupId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Backup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_getlateststatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_getlateststatus.go new file mode 100644 index 000000000000..1668fdfcf7e1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_getlateststatus.go @@ -0,0 +1,54 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GetLatestStatusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *BackupStatus +} + +// GetLatestStatus ... +func (c BackupsClient) GetLatestStatus(ctx context.Context, id VolumeId) (result GetLatestStatusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/latestBackupStatus/current", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model BackupStatus + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_listbyvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_listbyvault.go new file mode 100644 index 000000000000..3416244ff498 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_listbyvault.go @@ -0,0 +1,134 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByVaultOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Backup +} + +type ListByVaultCompleteResult struct { + LatestHttpResponse *http.Response + Items []Backup +} + +type ListByVaultOperationOptions struct { + Filter *string +} + +func DefaultListByVaultOperationOptions() ListByVaultOperationOptions { + return ListByVaultOperationOptions{} +} + +func (o ListByVaultOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByVaultOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByVaultOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +type ListByVaultCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByVaultCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByVault ... +func (c BackupsClient) ListByVault(ctx context.Context, id BackupVaultId, options ListByVaultOperationOptions) (result ListByVaultOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByVaultCustomPager{}, + Path: fmt.Sprintf("%s/backups", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]Backup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByVaultComplete retrieves all the results into a single object +func (c BackupsClient) ListByVaultComplete(ctx context.Context, id BackupVaultId, options ListByVaultOperationOptions) (ListByVaultCompleteResult, error) { + return c.ListByVaultCompleteMatchingPredicate(ctx, id, options, BackupOperationPredicate{}) +} + +// ListByVaultCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c BackupsClient) ListByVaultCompleteMatchingPredicate(ctx context.Context, id BackupVaultId, options ListByVaultOperationOptions, predicate BackupOperationPredicate) (result ListByVaultCompleteResult, err error) { + items := make([]Backup, 0) + + resp, err := c.ListByVault(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByVaultCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_underaccountmigratebackups.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_underaccountmigratebackups.go new file mode 100644 index 000000000000..d8792fed2b6d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_underaccountmigratebackups.go @@ -0,0 +1,73 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UnderAccountMigrateBackupsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UnderAccountMigrateBackups ... +func (c BackupsClient) UnderAccountMigrateBackups(ctx context.Context, id NetAppAccountId, input BackupsMigrationRequest) (result UnderAccountMigrateBackupsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrateBackups", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UnderAccountMigrateBackupsThenPoll performs UnderAccountMigrateBackups then polls until it's completed +func (c BackupsClient) UnderAccountMigrateBackupsThenPoll(ctx context.Context, id NetAppAccountId, input BackupsMigrationRequest) error { + result, err := c.UnderAccountMigrateBackups(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UnderAccountMigrateBackups: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UnderAccountMigrateBackups: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_underbackupvaultrestorefiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_underbackupvaultrestorefiles.go new file mode 100644 index 000000000000..fae1ff9c3ac0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_underbackupvaultrestorefiles.go @@ -0,0 +1,73 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UnderBackupVaultRestoreFilesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UnderBackupVaultRestoreFiles ... +func (c BackupsClient) UnderBackupVaultRestoreFiles(ctx context.Context, id BackupId, input BackupRestoreFiles) (result UnderBackupVaultRestoreFilesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restoreFiles", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UnderBackupVaultRestoreFilesThenPoll performs UnderBackupVaultRestoreFiles then polls until it's completed +func (c BackupsClient) UnderBackupVaultRestoreFilesThenPoll(ctx context.Context, id BackupId, input BackupRestoreFiles) error { + result, err := c.UnderBackupVaultRestoreFiles(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UnderBackupVaultRestoreFiles: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UnderBackupVaultRestoreFiles: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_undervolumemigratebackups.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_undervolumemigratebackups.go new file mode 100644 index 000000000000..1bbdca6b0841 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_undervolumemigratebackups.go @@ -0,0 +1,73 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UnderVolumeMigrateBackupsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UnderVolumeMigrateBackups ... +func (c BackupsClient) UnderVolumeMigrateBackups(ctx context.Context, id VolumeId, input BackupsMigrationRequest) (result UnderVolumeMigrateBackupsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrateBackups", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UnderVolumeMigrateBackupsThenPoll performs UnderVolumeMigrateBackups then polls until it's completed +func (c BackupsClient) UnderVolumeMigrateBackupsThenPoll(ctx context.Context, id VolumeId, input BackupsMigrationRequest) error { + result, err := c.UnderVolumeMigrateBackups(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UnderVolumeMigrateBackups: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UnderVolumeMigrateBackups: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_update.go new file mode 100644 index 000000000000..0a8669d7caa4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/method_update.go @@ -0,0 +1,75 @@ +package backups + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Backup +} + +// Update ... +func (c BackupsClient) Update(ctx context.Context, id BackupId, input BackupPatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c BackupsClient) UpdateThenPoll(ctx context.Context, id BackupId, input BackupPatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backup.go new file mode 100644 index 000000000000..ef5ef0a7bc60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backup.go @@ -0,0 +1,16 @@ +package backups + +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 Backup struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties BackupProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuppatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuppatch.go new file mode 100644 index 000000000000..a87251f4b0c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuppatch.go @@ -0,0 +1,8 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPatch struct { + Properties *BackupPatchProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuppatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuppatchproperties.go new file mode 100644 index 000000000000..b374bda31438 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuppatchproperties.go @@ -0,0 +1,8 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupPatchProperties struct { + Label *string `json:"label,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupproperties.go new file mode 100644 index 000000000000..168aa8182a95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupproperties.go @@ -0,0 +1,36 @@ +package backups + +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 BackupProperties struct { + BackupId *string `json:"backupId,omitempty"` + BackupPolicyResourceId *string `json:"backupPolicyResourceId,omitempty"` + BackupType *BackupType `json:"backupType,omitempty"` + CreationDate *string `json:"creationDate,omitempty"` + FailureReason *string `json:"failureReason,omitempty"` + Label *string `json:"label,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Size *int64 `json:"size,omitempty"` + SnapshotName *string `json:"snapshotName,omitempty"` + UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` + VolumeResourceId string `json:"volumeResourceId"` +} + +func (o *BackupProperties) GetCreationDateAsTime() (*time.Time, error) { + if o.CreationDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.CreationDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *BackupProperties) SetCreationDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.CreationDate = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuprestorefiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuprestorefiles.go new file mode 100644 index 000000000000..e26ce886407f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backuprestorefiles.go @@ -0,0 +1,10 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupRestoreFiles struct { + DestinationVolumeId string `json:"destinationVolumeId"` + FileList []string `json:"fileList"` + RestoreFilePath *string `json:"restoreFilePath,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupsmigrationrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupsmigrationrequest.go new file mode 100644 index 000000000000..f0fb612b507d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupsmigrationrequest.go @@ -0,0 +1,8 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupsMigrationRequest struct { + BackupVaultId string `json:"backupVaultId"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupstatus.go new file mode 100644 index 000000000000..e873cd9463d2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/model_backupstatus.go @@ -0,0 +1,16 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupStatus struct { + ErrorMessage *string `json:"errorMessage,omitempty"` + Healthy *bool `json:"healthy,omitempty"` + LastTransferSize *int64 `json:"lastTransferSize,omitempty"` + LastTransferType *string `json:"lastTransferType,omitempty"` + MirrorState *MirrorState `json:"mirrorState,omitempty"` + RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` + TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` + TransferProgressBytes *int64 `json:"transferProgressBytes,omitempty"` + UnhealthyReason *string `json:"unhealthyReason,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/predicates.go new file mode 100644 index 000000000000..f5033a2bb91f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/predicates.go @@ -0,0 +1,27 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p BackupOperationPredicate) Matches(input Backup) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + 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/2024-03-01/backups/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/version.go new file mode 100644 index 000000000000..434265f8cb98 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups/version.go @@ -0,0 +1,10 @@ +package backups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-03-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/backups/2024-03-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/README.md new file mode 100644 index 000000000000..9bc1ae14b5df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults` Documentation + +The `backupvaults` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2024-03-01/backupvaults" +``` + + +### Client Initialization + +```go +client := backupvaults.NewBackupVaultsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `BackupVaultsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName") + +payload := backupvaults.BackupVault{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupVaultsClient.Delete` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `BackupVaultsClient.Get` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName") + +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: `BackupVaultsClient.ListByNetAppAccount` + +```go +ctx := context.TODO() +id := backupvaults.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName") + +// alternatively `client.ListByNetAppAccount(ctx, id)` can be used to do batched pagination +items, err := client.ListByNetAppAccountComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `BackupVaultsClient.Update` + +```go +ctx := context.TODO() +id := backupvaults.NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountName", "backupVaultName") + +payload := backupvaults.BackupVaultPatch{ + // ... +} + + +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/2024-03-01/backupvaults/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/client.go new file mode 100644 index 000000000000..57d96b431b5e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/client.go @@ -0,0 +1,26 @@ +package backupvaults + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVaultsClient struct { + Client *resourcemanager.Client +} + +func NewBackupVaultsClientWithBaseURI(sdkApi sdkEnv.Api) (*BackupVaultsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "backupvaults", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating BackupVaultsClient: %+v", err) + } + + return &BackupVaultsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/id_backupvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/id_backupvault.go new file mode 100644 index 000000000000..84c031650621 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/id_backupvault.go @@ -0,0 +1,139 @@ +package backupvaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&BackupVaultId{}) +} + +var _ resourceids.ResourceId = &BackupVaultId{} + +// BackupVaultId is a struct representing the Resource ID for a Backup Vault +type BackupVaultId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string + BackupVaultName string +} + +// NewBackupVaultID returns a new BackupVaultId struct +func NewBackupVaultID(subscriptionId string, resourceGroupName string, netAppAccountName string, backupVaultName string) BackupVaultId { + return BackupVaultId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + BackupVaultName: backupVaultName, + } +} + +// ParseBackupVaultID parses 'input' into a BackupVaultId +func ParseBackupVaultID(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupVaultId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseBackupVaultIDInsensitively parses 'input' case-insensitively into a BackupVaultId +// note: this method should only be used for API response data and not user input +func ParseBackupVaultIDInsensitively(input string) (*BackupVaultId, error) { + parser := resourceids.NewParserFromResourceIdType(&BackupVaultId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := BackupVaultId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *BackupVaultId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + if id.BackupVaultName, ok = input.Parsed["backupVaultName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "backupVaultName", input) + } + + return nil +} + +// ValidateBackupVaultID checks that 'input' can be parsed as a Backup Vault ID +func ValidateBackupVaultID(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 := ParseBackupVaultID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Backup Vault ID +func (id BackupVaultId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/backupVaults/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.BackupVaultName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Backup Vault ID +func (id BackupVaultId) 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("netAppAccountName", "netAppAccountName"), + resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), + resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultName"), + } +} + +// String returns a human-readable description of this Backup Vault ID +func (id BackupVaultId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), + fmt.Sprintf("Backup Vault Name: %q", id.BackupVaultName), + } + return fmt.Sprintf("Backup Vault (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/id_netappaccount.go new file mode 100644 index 000000000000..203dcf207ec0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/id_netappaccount.go @@ -0,0 +1,130 @@ +package backupvaults + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&NetAppAccountId{}) +} + +var _ resourceids.ResourceId = &NetAppAccountId{} + +// NetAppAccountId is a struct representing the Resource ID for a Net App Account +type NetAppAccountId struct { + SubscriptionId string + ResourceGroupName string + NetAppAccountName string +} + +// NewNetAppAccountID returns a new NetAppAccountId struct +func NewNetAppAccountID(subscriptionId string, resourceGroupName string, netAppAccountName string) NetAppAccountId { + return NetAppAccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + NetAppAccountName: netAppAccountName, + } +} + +// 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) + } + + id := NetAppAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + 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) + } + + id := NetAppAccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *NetAppAccountId) FromParseResult(input resourceids.ParseResult) error { + var ok bool + + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) + } + + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) + } + + if id.NetAppAccountName, ok = input.Parsed["netAppAccountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "netAppAccountName", input) + } + + return 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.NetAppAccountName) +} + +// 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("netAppAccountName", "netAppAccountName"), + } +} + +// 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("Net App Account Name: %q", id.NetAppAccountName), + } + return fmt.Sprintf("Net App Account (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_createorupdate.go new file mode 100644 index 000000000000..0f75206e2d7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_createorupdate.go @@ -0,0 +1,75 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BackupVault +} + +// CreateOrUpdate ... +func (c BackupVaultsClient) CreateOrUpdate(ctx context.Context, id BackupVaultId, input BackupVault) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed +func (c BackupVaultsClient) CreateOrUpdateThenPoll(ctx context.Context, id BackupVaultId, input BackupVault) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_delete.go new file mode 100644 index 000000000000..32a1387f1ba7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_delete.go @@ -0,0 +1,70 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c BackupVaultsClient) Delete(ctx context.Context, id BackupVaultId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c BackupVaultsClient) DeleteThenPoll(ctx context.Context, id BackupVaultId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_get.go new file mode 100644 index 000000000000..6cd544f7ca95 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_get.go @@ -0,0 +1,53 @@ +package backupvaults + +import ( + "context" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 + OData *odata.OData + Model *BackupVault +} + +// Get ... +func (c BackupVaultsClient) Get(ctx context.Context, id BackupVaultId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model BackupVault + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_listbynetappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_listbynetappaccount.go new file mode 100644 index 000000000000..a0f46fc10236 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_listbynetappaccount.go @@ -0,0 +1,105 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ListByNetAppAccountOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]BackupVault +} + +type ListByNetAppAccountCompleteResult struct { + LatestHttpResponse *http.Response + Items []BackupVault +} + +type ListByNetAppAccountCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByNetAppAccountCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByNetAppAccount ... +func (c BackupVaultsClient) ListByNetAppAccount(ctx context.Context, id NetAppAccountId) (result ListByNetAppAccountOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByNetAppAccountCustomPager{}, + Path: fmt.Sprintf("%s/backupVaults", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.ExecutePaged(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var values struct { + Values *[]BackupVault `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByNetAppAccountComplete retrieves all the results into a single object +func (c BackupVaultsClient) ListByNetAppAccountComplete(ctx context.Context, id NetAppAccountId) (ListByNetAppAccountCompleteResult, error) { + return c.ListByNetAppAccountCompleteMatchingPredicate(ctx, id, BackupVaultOperationPredicate{}) +} + +// ListByNetAppAccountCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c BackupVaultsClient) ListByNetAppAccountCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate BackupVaultOperationPredicate) (result ListByNetAppAccountCompleteResult, err error) { + items := make([]BackupVault, 0) + + resp, err := c.ListByNetAppAccount(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByNetAppAccountCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_update.go new file mode 100644 index 000000000000..8ea7dce31232 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/method_update.go @@ -0,0 +1,75 @@ +package backupvaults + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// 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 pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *BackupVault +} + +// Update ... +func (c BackupVaultsClient) Update(ctx context.Context, id BackupVaultId, input BackupVaultPatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + if err = req.Marshal(input); err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// UpdateThenPoll performs Update then polls until it's completed +func (c BackupVaultsClient) UpdateThenPoll(ctx context.Context, id BackupVaultId, input BackupVaultPatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvault.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvault.go new file mode 100644 index 000000000000..0e8761f2293a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvault.go @@ -0,0 +1,18 @@ +package backupvaults + +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 BackupVault struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *BackupVaultProperties `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/2024-03-01/backupvaults/model_backupvaultpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvaultpatch.go new file mode 100644 index 000000000000..899e2ecf858c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvaultpatch.go @@ -0,0 +1,8 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVaultPatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvaultproperties.go new file mode 100644 index 000000000000..7327d4d21196 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/model_backupvaultproperties.go @@ -0,0 +1,8 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVaultProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/predicates.go new file mode 100644 index 000000000000..53d942f568ce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/predicates.go @@ -0,0 +1,32 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BackupVaultOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p BackupVaultOperationPredicate) Matches(input BackupVault) bool { + + 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/2024-03-01/backupvaults/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/version.go new file mode 100644 index 000000000000..692bfdc12575 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults/version.go @@ -0,0 +1,10 @@ +package backupvaults + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-03-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/backupvaults/2024-03-01" +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/README.md similarity index 95% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/README.md index e6cf8336b625..333457abfcea 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools` Documentation -The `capacitypools` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `capacitypools` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/capacitypools" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/id_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/id_capacitypool.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/id_capacitypool.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/id_capacitypool.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/id_netappaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/id_netappaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/id_netappaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolscreateorupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolscreateorupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolscreateorupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolsdelete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolsdelete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolsdelete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolsget.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolsget.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolsget.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolslist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolslist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolslist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolsupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolsupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/method_poolsupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/method_poolsupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_capacitypool.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_capacitypool.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_capacitypool.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_capacitypoolpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_capacitypoolpatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_capacitypoolpatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_capacitypoolpatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_poolpatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_poolpatchproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_poolpatchproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_poolpatchproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_poolproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_poolproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/model_poolproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/model_poolproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/version.go index 827826ab30a4..9dc11f4a92cb 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools/version.go @@ -3,8 +3,8 @@ package capacitypools // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/capacitypools/2023-05-01" + return "hashicorp/go-azure-sdk/capacitypools/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/README.md similarity index 96% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/README.md index c5c5f9927016..00896a21f6e6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/README.md @@ -1,7 +1,7 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts` Documentation -The `netappaccounts` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `netappaccounts` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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). @@ -9,7 +9,7 @@ This readme covers example usages, but further information on [using this SDK ca ```go import "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" -import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/id_netappaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/id_netappaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/id_netappaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountscreateorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountscreateorupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountscreateorupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountscreateorupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsdelete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsdelete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsdelete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsget.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsget.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsget.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountslist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountslist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountslist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountslistbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountslistbysubscription.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountslistbysubscription.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountslistbysubscription.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsrenewcredentials.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsrenewcredentials.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsrenewcredentials.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsrenewcredentials.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/method_accountsupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/method_accountsupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_accountencryption.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_accountencryption.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_accountencryption.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_accountencryption.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_accountproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_accountproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_accountproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_accountproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_activedirectory.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_activedirectory.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_activedirectory.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_activedirectory.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_encryptionidentity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_encryptionidentity.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_encryptionidentity.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_encryptionidentity.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_keyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_keyvaultproperties.go similarity index 85% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_keyvaultproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_keyvaultproperties.go index ac5d8c6afa48..f4722a948a2e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_keyvaultproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_keyvaultproperties.go @@ -6,7 +6,7 @@ package netappaccounts type KeyVaultProperties struct { KeyName string `json:"keyName"` KeyVaultId *string `json:"keyVaultId,omitempty"` - KeyVaultResourceId string `json:"keyVaultResourceId"` + KeyVaultResourceId *string `json:"keyVaultResourceId,omitempty"` KeyVaultUri string `json:"keyVaultUri"` Status *KeyVaultStatus `json:"status,omitempty"` } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_ldapsearchscopeopt.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_ldapsearchscopeopt.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_ldapsearchscopeopt.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_ldapsearchscopeopt.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_netappaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_netappaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_netappaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_netappaccountpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_netappaccountpatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/model_netappaccountpatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/model_netappaccountpatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/version.go index c5c99dfeca81..ec5f35de42de 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts/version.go @@ -3,8 +3,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. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/netappaccounts/2023-05-01" + return "hashicorp/go-azure-sdk/netappaccounts/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/README.md similarity index 95% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/README.md index ce7bccd2bc3d..e3b1ebd141a4 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy` Documentation -The `snapshotpolicy` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `snapshotpolicy` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/snapshotpolicy" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/id_netappaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/id_netappaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/id_netappaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/id_snapshotpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/id_snapshotpolicy.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/id_snapshotpolicy.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/id_snapshotpolicy.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciescreate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciescreate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciescreate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciescreate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciesdelete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciesdelete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciesdelete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciesdelete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciesget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciesget.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciesget.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciesget.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpolicieslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpolicieslist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpolicieslist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpolicieslist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciesupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciesupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/method_snapshotpoliciesupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/method_snapshotpoliciesupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_dailyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_dailyschedule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_dailyschedule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_dailyschedule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_hourlyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_hourlyschedule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_hourlyschedule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_hourlyschedule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_monthlyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_monthlyschedule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_monthlyschedule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_monthlyschedule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicieslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicieslist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicieslist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicieslist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicy.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicy.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicy.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicypatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicypatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicypatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicypatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicyproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicyproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_snapshotpolicyproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_snapshotpolicyproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_weeklyschedule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_weeklyschedule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/model_weeklyschedule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/model_weeklyschedule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/version.go index 4030344dfeee..b0ad9aef745d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy/version.go @@ -3,8 +3,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. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/snapshotpolicy/2023-05-01" + return "hashicorp/go-azure-sdk/snapshotpolicy/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/README.md similarity index 96% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/README.md index b28bdd0a5d2e..528d345277b6 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots` Documentation -The `snapshots` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `snapshots` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/snapshots" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/id_snapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/id_snapshot.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/id_snapshot.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/id_snapshot.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/id_volume.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/id_volume.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/id_volume.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_list.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_list.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_list.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_restorefiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_restorefiles.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_restorefiles.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_restorefiles.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshot.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshot.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshot.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshot.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshotproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshotproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshotproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshotproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshotrestorefiles.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshotrestorefiles.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshotrestorefiles.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshotrestorefiles.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshotslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshotslist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/model_snapshotslist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/model_snapshotslist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/version.go index 83ff2ccae966..8dd79283032d 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots/version.go @@ -3,8 +3,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. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/snapshots/2023-05-01" + return "hashicorp/go-azure-sdk/snapshots/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/README.md similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/README.md index 358b4d711015..4dceebb836e9 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups` Documentation -The `volumegroups` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `volumegroups` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/volumegroups" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/id_netappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/id_netappaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/id_netappaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/id_netappaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/id_volumegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/id_volumegroup.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/id_volumegroup.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/id_volumegroup.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_listbynetappaccount.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_listbynetappaccount.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/method_listbynetappaccount.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/method_listbynetappaccount.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_exportpolicyrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_exportpolicyrule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_exportpolicyrule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_exportpolicyrule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_mounttargetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_mounttargetproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_mounttargetproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_mounttargetproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_placementkeyvaluepairs.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_placementkeyvaluepairs.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_placementkeyvaluepairs.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_placementkeyvaluepairs.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_replicationobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_replicationobject.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_replicationobject.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_replicationobject.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumebackupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumebackupproperties.go new file mode 100644 index 000000000000..39ce5a2b79ba --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumebackupproperties.go @@ -0,0 +1,10 @@ +package volumegroups + +// 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 { + BackupPolicyId *string `json:"backupPolicyId,omitempty"` + BackupVaultId *string `json:"backupVaultId,omitempty"` + PolicyEnforced *bool `json:"policyEnforced,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroup.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroup.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroup.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupdetails.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupdetails.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupdetails.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegrouplist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegrouplist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegrouplist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegrouplist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegrouplistproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegrouplistproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegrouplistproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegrouplistproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupmetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupmetadata.go similarity index 88% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupmetadata.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupmetadata.go index 30441c6826d5..b9fa343690c2 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupmetadata.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupmetadata.go @@ -6,7 +6,6 @@ package volumegroups type VolumeGroupMetaData struct { ApplicationIdentifier *string `json:"applicationIdentifier,omitempty"` ApplicationType *ApplicationType `json:"applicationType,omitempty"` - DeploymentSpecId *string `json:"deploymentSpecId,omitempty"` GlobalPlacementRules *[]PlacementKeyValuePairs `json:"globalPlacementRules,omitempty"` GroupDescription *string `json:"groupDescription,omitempty"` VolumesCount *int64 `json:"volumesCount,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupvolumeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupvolumeproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumegroupvolumeproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumegroupvolumeproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumeproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumeproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumeproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumepropertiesdataprotection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumepropertiesdataprotection.go similarity index 86% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumepropertiesdataprotection.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumepropertiesdataprotection.go index b97d3a9230f9..632e45e64b06 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumepropertiesdataprotection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumepropertiesdataprotection.go @@ -4,6 +4,7 @@ package volumegroups // 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"` VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumepropertiesexportpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumepropertiesexportpolicy.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumepropertiesexportpolicy.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumepropertiesexportpolicy.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumerelocationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumerelocationproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumerelocationproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumerelocationproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumesnapshotproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumesnapshotproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/model_volumesnapshotproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/model_volumesnapshotproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/version.go similarity index 68% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/version.go index 7c7d97845045..7267a3b94128 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups/version.go @@ -3,8 +3,8 @@ package volumegroups // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/volumegroups/2023-05-01" + return "hashicorp/go-azure-sdk/volumegroups/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/README.md similarity index 95% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/README.md index 0298eff30400..7f2b7139307a 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules` Documentation -The `volumequotarules` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `volumequotarules` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/volumequotarules" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/id_volume.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/id_volume.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/id_volume.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/id_volumequotarule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/id_volumequotarule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/id_volumequotarule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/id_volumequotarule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_create.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_create.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_create.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_listbyvolume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_listbyvolume.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_listbyvolume.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_listbyvolume.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotarule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotarule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotarule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotarule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotarulepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotarulepatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotarulepatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotarulepatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotaruleslist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotaruleslist.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotaruleslist.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotaruleslist.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotarulesproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotarulesproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/model_volumequotarulesproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/model_volumequotarulesproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/version.go similarity index 67% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/version.go index 331229644b27..078a65c7f3d5 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules/version.go @@ -3,8 +3,8 @@ package volumequotarules // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See NOTICE.txt in the project root for license information. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/volumequotarules/2023-05-01" + return "hashicorp/go-azure-sdk/volumequotarules/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/README.md similarity index 96% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/README.md index c26acb94610a..6112def45159 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes` Documentation -The `volumes` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `volumes` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/volumes" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/id_capacitypool.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/id_capacitypool.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/id_capacitypool.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/id_capacitypool.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/id_volume.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/id_volume.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/id_volume.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_createorupdate.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_createorupdate.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_createorupdate.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_delete.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_delete.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_delete.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_get.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_get.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_get.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_list.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_list.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_list.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_populateavailabilityzone.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_populateavailabilityzone.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_populateavailabilityzone.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_populateavailabilityzone.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_update.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/method_update.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/method_update.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_exportpolicyrule.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_exportpolicyrule.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_exportpolicyrule.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_exportpolicyrule.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_mounttargetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_mounttargetproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_mounttargetproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_mounttargetproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_placementkeyvaluepairs.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_placementkeyvaluepairs.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_placementkeyvaluepairs.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_placementkeyvaluepairs.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_replicationobject.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_replicationobject.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_replicationobject.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_replicationobject.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volume.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volume.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volume.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumebackupproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumebackupproperties.go new file mode 100644 index 000000000000..a74e6fd4d162 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumebackupproperties.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 VolumeBackupProperties struct { + BackupPolicyId *string `json:"backupPolicyId,omitempty"` + BackupVaultId *string `json:"backupVaultId,omitempty"` + PolicyEnforced *bool `json:"policyEnforced,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatch.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatch.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatch.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchproperties.go similarity index 94% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchproperties.go index f2257b566714..716cd8f9697e 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchproperties.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchproperties.go @@ -12,6 +12,7 @@ type VolumePatchProperties struct { DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` + ProtocolTypes *[]string `json:"protocolTypes,omitempty"` ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchpropertiesdataprotection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchpropertiesdataprotection.go similarity index 82% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchpropertiesdataprotection.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchpropertiesdataprotection.go index 6b54432bc61b..8c9edc10ff72 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchpropertiesdataprotection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchpropertiesdataprotection.go @@ -4,5 +4,6 @@ package volumes // 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/2023-05-01/volumes/model_volumepatchpropertiesexportpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchpropertiesexportpolicy.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepatchpropertiesexportpolicy.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepatchpropertiesexportpolicy.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumeproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumeproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumeproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepropertiesdataprotection.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepropertiesdataprotection.go similarity index 86% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepropertiesdataprotection.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepropertiesdataprotection.go index e23524897548..fcf952952d20 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepropertiesdataprotection.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepropertiesdataprotection.go @@ -4,6 +4,7 @@ package volumes // 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"` VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepropertiesexportpolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepropertiesexportpolicy.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumepropertiesexportpolicy.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumepropertiesexportpolicy.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumerelocationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumerelocationproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumerelocationproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumerelocationproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumesnapshotproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumesnapshotproperties.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/model_volumesnapshotproperties.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/model_volumesnapshotproperties.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/predicates.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/predicates.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/predicates.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/version.go similarity index 69% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/version.go index f53e1e97e5ec..76b4004cf743 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes/version.go @@ -3,8 +3,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. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/volumes/2023-05-01" + return "hashicorp/go-azure-sdk/volumes/2024-03-01" } diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/README.md similarity index 96% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/README.md rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/README.md index c6f7f129e36e..29bdb10cf010 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/README.md +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/README.md @@ -1,14 +1,14 @@ -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication` Documentation +## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication` Documentation -The `volumesreplication` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2023-05-01`). +The `volumesreplication` SDK allows for interaction with Azure Resource Manager `netapp` (API Version `2024-03-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/2023-05-01/volumesreplication" +import "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication" ``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/client.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/client.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/client.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/constants.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/constants.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/constants.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/id_volume.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/id_volume.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/id_volume.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/id_volume.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesauthorizereplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesauthorizereplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesauthorizereplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesauthorizereplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesbreakreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesbreakreplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesbreakreplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesbreakreplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesdeletereplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesdeletereplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesdeletereplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesdeletereplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumeslistreplications.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumeslistreplications.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumeslistreplications.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumeslistreplications.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesreestablishreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesreestablishreplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesreestablishreplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesreestablishreplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesreinitializereplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesreinitializereplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesreinitializereplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesreinitializereplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesreplicationstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesreplicationstatus.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesreplicationstatus.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesreplicationstatus.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesresyncreplication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesresyncreplication.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/method_volumesresyncreplication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/method_volumesresyncreplication.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_authorizerequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_authorizerequest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_authorizerequest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_authorizerequest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_breakreplicationrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_breakreplicationrequest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_breakreplicationrequest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_breakreplicationrequest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_listreplications.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_listreplications.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_listreplications.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_listreplications.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_reestablishreplicationrequest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_reestablishreplicationrequest.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_reestablishreplicationrequest.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_reestablishreplicationrequest.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_replication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_replication.go similarity index 87% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_replication.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_replication.go index 06e345fdb5e6..ff1273507a2b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_replication.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_replication.go @@ -7,5 +7,6 @@ type Replication 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/2023-05-01/volumesreplication/model_replicationstatus.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_replicationstatus.go similarity index 100% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/model_replicationstatus.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/model_replicationstatus.go diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/version.go similarity index 67% rename from vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/version.go rename to vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/version.go index be1c25aec8f6..2ce59d52eb4b 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication/version.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication/version.go @@ -3,8 +3,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. -const defaultApiVersion = "2023-05-01" +const defaultApiVersion = "2024-03-01" func userAgent() string { - return "hashicorp/go-azure-sdk/volumesreplication/2023-05-01" + return "hashicorp/go-azure-sdk/volumesreplication/2024-03-01" } diff --git a/vendor/modules.txt b/vendor/modules.txt index 17d269b35a92..41bfc53c87da 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -687,14 +687,17 @@ github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servers github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/serverstart github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/serverstop github.com/hashicorp/go-azure-sdk/resource-manager/mysql/2023-12-30/servervalidateestimatehighavailability -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/capacitypools -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/netappaccounts -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshotpolicy -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/snapshots -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumegroups -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumequotarules -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumes -github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2023-05-01/volumesreplication +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backuppolicy +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backups +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/backupvaults +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/capacitypools +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/netappaccounts +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshotpolicy +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/snapshots +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumegroups +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumequotarules +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumes +github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2024-03-01/volumesreplication github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/applicationsecuritygroups github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/azurefirewalls github.com/hashicorp/go-azure-sdk/resource-manager/network/2023-09-01/ddosprotectionplans diff --git a/website/docs/d/netapp_backup_policy.html.markdown b/website/docs/d/netapp_backup_policy.html.markdown new file mode 100644 index 000000000000..b94b4f537d8c --- /dev/null +++ b/website/docs/d/netapp_backup_policy.html.markdown @@ -0,0 +1,67 @@ +--- +subcategory: "NetApp" +layout: "azurerm" +page_title: "Azure Resource Manager: netapp_backup_policy" +description: |- + Gets information about an existing NetApp Backup Policy +--- + +# Data Source: netapp_backup_policy + +Use this data source to access information about an existing NetApp Backup Vault. + +## NetApp Backup Policy Usage + +```hcl +data "azurerm_netapp_backup_policy" "example" { + resource_group_name = "example-resource-group" + account_name = "example-netappaccount" + name = "example-backuppolicy" +} + +output "backup_policy_id" { + value = data.azurerm_netapp_backup_policy.example.id +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - The name of the NetApp Backup Policy. + +* `resource_group_name` - The name of the resource group where the NetApp Backup Policy exists. + +* `account_name` - The name of the NetApp Account in which the NetApp Policy exists. + +## Attributes Reference + +The following attributes are exported: + +* `location` - NetApp Backup Policy location. + +* `account_name` - The name of the NetApp account in which the NetApp Policy exists. + +* `daily_backups_to_keep` - The number of daily backups to keep. + +* `weekly_backups_to_keep` - The number of weekly backups to keep. + +* `monthly_backups_to_keep` - The number of monthly backups to keep. + +* `enabled` - Whether the Backup Policy is enabled. + +* `tags` - List of tags assigned to the resource. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the NetApp Backup Policy. + +## Import + +NetApp Backup Policy can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_netapp_backup_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backuppolicy1 +``` diff --git a/website/docs/d/netapp_backup_vault.html.markdown b/website/docs/d/netapp_backup_vault.html.markdown new file mode 100644 index 000000000000..e5494d3e65bf --- /dev/null +++ b/website/docs/d/netapp_backup_vault.html.markdown @@ -0,0 +1,49 @@ +--- +subcategory: "NetApp" +layout: "azurerm" +page_title: "Azure Resource Manager: netapp_backup_vault" +description: |- + Gets information about an existing NetApp Backup Vault +--- + +# Data Source: netapp_backup_vault + +Use this data source to access information about an existing NetApp Backup Vault. + +## NetApp Backup Vault Usage + +```hcl +data "azurerm_netapp_backup_vault" "example" { + resource_group_name = "example-resource-group" + account_name = "example-netappaccount" + name = "example-backupvault" +} + +output "backup_vault_id" { + value = data.azurerm_netapp_backup_vault.example.id +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - The name of the NetApp Backup Vault. + +* `resource_group_name` - The name of the resource group where the NetApp Backup Vault exists. + +* `account_name` - The name of the NetApp Account in which the NetApp Vault exists. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `read` - (Defaults to 5 minutes) Used when retrieving the NetApp Backup Vault. + +## Import + +NetApp Backup Vault can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_netapp_backup_vault.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backupvault1 +``` diff --git a/website/docs/d/netapp_volume.html.markdown b/website/docs/d/netapp_volume.html.markdown index 1b15c2955ca6..9fadb3d7e7fc 100644 --- a/website/docs/d/netapp_volume.html.markdown +++ b/website/docs/d/netapp_volume.html.markdown @@ -59,7 +59,9 @@ The following attributes are exported: * `security_style` - Volume security style -* `data_protection_replication` - Volume data protection block +* `data_protection_replication` - Volume data protection replication block + +* `data_protection_backup_policy` - A data protecion backup policy block * `volume_path` - The unique file path of the volume. @@ -81,6 +83,16 @@ A `data_protection_replication` block exports the following: --- +A `data_protection_backup_policy` block supports the following: + +* `backup_vault_id` - The Resource ID of the backup backup vault. + +* `backup_policy_id` - The Resource ID of the backup policy. + +* `policy_enabled` - Backup policy is enabled or not. + +--- + ## Timeouts The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: diff --git a/website/docs/guides/features-block.html.markdown b/website/docs/guides/features-block.html.markdown index 622b139922cb..0ae8ac8639d3 100644 --- a/website/docs/guides/features-block.html.markdown +++ b/website/docs/guides/features-block.html.markdown @@ -62,6 +62,11 @@ provider "azurerm" { expand_without_downtime = true } + netapp { + delete_backups_on_backup_vault_destroy = false + prevent_volume_destruction = true + } + postgresql_flexible_server { restart_server_on_configuration_value_change = true } @@ -123,6 +128,8 @@ The `features` block supports the following: * `managed_disk` - (Optional) A `managed_disk` block as defined below. +* `netapp` - (Optional) A `netapp` block as defined below. + * `recovery_service` - (Optional) A `recovery_service` block as defined below. * `resource_group` - (Optional) A `resource_group` block as defined below. @@ -217,6 +224,13 @@ The `managed_disk` block supports the following: --- +The `netapp` block supports the following: + +* `delete_backups_on_backup_vault_destroy` - (Optional) Should backups be deleted when an `azurerm_netapp_backup_vault` is being deleted? Defaults to `false`. +* `prevent_volume_destruction` - (Optional) Should an `azurerm_netapp_volume` be protected against deletion (intentionally or unintentionally)? Defaults to `true`. + +--- + The `postgresql_flexible_server` block supports the following: * `restart_server_on_configuration_value_change` - (Optional) Should the `postgresql_flexible_server` restart after static server parameter change or removal? Defaults to `true`. diff --git a/website/docs/r/netapp_backup_policy.html.markdown b/website/docs/r/netapp_backup_policy.html.markdown new file mode 100644 index 000000000000..62baec2951e5 --- /dev/null +++ b/website/docs/r/netapp_backup_policy.html.markdown @@ -0,0 +1,75 @@ +--- +subcategory: "NetApp" +layout: "azurerm" +page_title: "Azure Resource Manager: netapp_backup_policy" +description: |- + Manages a NetApp Backup Policy. +--- + +# netapp_backup_policy + +Manages a NetApp Backup Policy. + +## NetApp Backup Policy Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_netapp_account" "example" { + name = "example-netappaccount" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_netapp_backup_policy" "example" { + name = "example-netappbackuppolicy" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_name = azurerm_netapp_account.example.name + enabled = true +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the NetApp Backup Policy. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group where the NetApp Backup Policy should be created. Changing this forces a new resource to be created. + +* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. + +* `account_name` - (Required) The name of the NetApp account in which the NetApp Policy should be created under. Changing this forces a new resource to be created. + +* `daily_backups_to_keep` - (Optional) Provides the number of daily backups to keep, defaults to `2` which is the minimum, maximum is 1019. + +* `weekly_backups_to_keep` - (Optional) Provides the number of weekly backups to keep, defaults to `1` which is the minimum, maximum is 1019. + +* `monthly_backups_to_keep` - (Optional) Provides the number of monthly backups to keep, defaults to `1` which is the minimum, maximum is 1019. + +~> **Note:** Currently, the combined (daily + weekly + monthy) retention counts cannot exceed 1019. + +* `enabled` - (Optional) Whether the Backup Policy is enabled. Defaults to `true`. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 90 minutes) Used when creating the NetApp Backup Policy. +* `update` - (Defaults to 120 minutes) Used when updating the NetApp Backup Policy. +* `read` - (Defaults to 5 minutes) Used when retrieving the NetApp Backup Policy. +* `delete` - (Defaults to 120 minutes) Used when deleting the NetApp Backup Policy. + +## Import + +NetApp Backup Policy can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_netapp_backup_policy.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/backupPolicies/backuppolicy1 +``` diff --git a/website/docs/r/netapp_backup_vault.html.markdown b/website/docs/r/netapp_backup_vault.html.markdown new file mode 100644 index 000000000000..72fcd2cf16f6 --- /dev/null +++ b/website/docs/r/netapp_backup_vault.html.markdown @@ -0,0 +1,64 @@ +--- +subcategory: "NetApp" +layout: "azurerm" +page_title: "Azure Resource Manager: netapp_backup_vault" +description: |- + Manages a NetApp Backup Vault. +--- + +# netapp_backup_vault + +Manages a NetApp Backup Vault. + +## NetApp Backup Vault Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_netapp_account" "example" { + name = "example-netappaccount" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name +} + +resource "azurerm_netapp_backup_vault" "example" { + name = "example-netappbackupvault" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_name = azurerm_netapp_account.example.name +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the NetApp Backup Vault. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the resource group where the NetApp Backup Vault should be created. Changing this forces a new resource to be created. + +* `location` - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. + +* `account_name` - (Required) The name of the NetApp account in which the NetApp Vault should be created under. Changing this forces a new resource to be created. + +* `tags` - (Optional) A mapping of tags to assign to the resource. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions: + +* `create` - (Defaults to 90 minutes) Used when creating the NetApp Backup Vault. +* `update` - (Defaults to 120 minutes) Used when updating the NetApp Backup Vault. +* `read` - (Defaults to 5 minutes) Used when retrieving the NetApp Backup Vault. +* `delete` - (Defaults to 120 minutes) Used when deleting the NetApp Backup Vault. + +## Import + +NetApp Backup Vault can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_netapp_backup_vault.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/backupVaults/backupVault1 +``` diff --git a/website/docs/r/netapp_volume.html.markdown b/website/docs/r/netapp_volume.html.markdown index b0fb29206f7a..68436260c99b 100644 --- a/website/docs/r/netapp_volume.html.markdown +++ b/website/docs/r/netapp_volume.html.markdown @@ -10,11 +10,20 @@ description: |- Manages a NetApp Volume. -!>**IMPORTANT:** To mitigate the possibility of accidental data loss it is highly recommended that you use the `prevent_destroy` lifecycle argument in your configuration file for this resource. For more information on the `prevent_destroy` lifecycle argument please see the [terraform documentation](https://developer.hashicorp.com/terraform/tutorials/state/resource-lifecycle#prevent-resource-deletion). +!>**IMPORTANT:** This resource uses a feature to prevent deletion called `prevent_volume_destruction`, defaulting to `true`. It is intentionally set to `true` to prevent the possibility of accidental data loss. The example in this page shows all possible protection options you can apply, it is using same values as the defaults. ## NetApp Volume Usage ```hcl +provider "azurerm" { + features { + netapp { + prevent_volume_destruction = true + delete_backups_on_backup_vault_destroy = false + } + } +} + resource "azurerm_resource_group" "example" { name = "example-resources" location = "West Europe" @@ -49,6 +58,24 @@ resource "azurerm_netapp_account" "example" { resource_group_name = azurerm_resource_group.example.name } +resource "azurerm_netapp_backup_vault" "example" { + name = "example-netappbackupvault" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_name = azurerm_netapp_account.example.name +} + +resource "azurerm_netapp_backup_policy" "example" { + name = "example-netappbackuppolicy" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + account_name = azurerm_netapp_account.example.name + daily_backups_to_keep = 2 + weekly_backups_to_keep = 2 + monthly_backups_to_keep = 2 + enabled = true +} + resource "azurerm_netapp_pool" "example" { name = "example-netapppool" location = azurerm_resource_group.example.location @@ -91,6 +118,13 @@ resource "azurerm_netapp_volume" "example" { snapshot_policy_id = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.NetApp/netAppAccounts/account1/snapshotPolicies/snapshotpolicy1" } + # Enabling backup policy + data_protection_backup_policy { + backup_vault_id = azurerm_netapp_backup_vault.example.id + backup_policy_id = azurerm_netapp_backup_policy.example.id + policy_enabled = true + } + # prevent the possibility of accidental data loss lifecycle { prevent_destroy = true @@ -138,6 +172,8 @@ The following arguments are supported: * `data_protection_snapshot_policy` - (Optional) A `data_protection_snapshot_policy` block as defined below. +* `data_protection_backup_policy` - (Optional) A `data_protection_backup_policy` block as defined below. + * `export_policy_rule` - (Optional) One or more `export_policy_rule` block defined below. * `throughput_in_mibps` - (Optional) Throughput of this volume in Mibps. @@ -218,6 +254,18 @@ A full example of the `data_protection_snapshot_policy` attribute usage can be f --- +A `data_protection_backup_policy` block is used to setup automatic backups through a specific backup policy. It supports the following: + +* `backup_vault_id` - (Required) Resource ID of the backup backup vault to associate this volume to. + +* `backup_policy_id` - (Required) Resource ID of the backup policy to apply to the volume. + +* `policy_enabled` - (Optional) Enables the backup policy on the volume, defaults to `true`. + +For more information on Azure NetApp Files Backup feature please see [Understand Azure NetApp Files backup](https://learn.microsoft.com/en-us/azure/azure-netapp-files/backup-introduction) + +--- + ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: