From 9e47dc7e8d70c7640fbfacc60f985bac630d7942 Mon Sep 17 00:00:00 2001 From: hc-github-team-tf-azure <> Date: Fri, 8 Dec 2023 12:46:23 +0000 Subject: [PATCH] Updating based on 91847d75a --- .../netapp/2022-05-01/backuppolicy/README.md | 98 --- .../netapp/2022-05-01/backuppolicy/client.go | 26 - .../backuppolicy/id_backuppolicy.go | 134 ---- .../backuppolicy/id_backuppolicy_test.go | 327 ---------- .../backuppolicy/id_netappaccount.go | 125 ---- .../backuppolicy/id_netappaccount_test.go | 282 --------- .../method_backuppoliciescreate.go | 75 --- .../method_backuppoliciesdelete.go | 71 --- .../backuppolicy/method_backuppoliciesget.go | 51 -- .../backuppolicy/method_backuppolicieslist.go | 52 -- .../method_backuppoliciesupdate.go | 74 --- .../backuppolicy/model_backuppolicieslist.go | 8 - .../backuppolicy/model_backuppolicy.go | 19 - .../backuppolicy/model_backuppolicypatch.go | 13 - .../model_backuppolicyproperties.go | 15 - .../backuppolicy/model_volumebackups.go | 10 - .../netapp/2022-05-01/backuppolicy/version.go | 12 - .../netapp/2022-05-01/backups/README.md | 158 ----- .../netapp/2022-05-01/backups/client.go | 26 - .../netapp/2022-05-01/backups/constants.go | 136 ---- .../2022-05-01/backups/id_accountbackup.go | 134 ---- .../backups/id_accountbackup_test.go | 327 ---------- .../netapp/2022-05-01/backups/id_backup.go | 152 ----- .../2022-05-01/backups/id_backup_test.go | 417 ------------ .../2022-05-01/backups/id_netappaccount.go | 125 ---- .../backups/id_netappaccount_test.go | 282 --------- .../netapp/2022-05-01/backups/id_volume.go | 143 ----- .../2022-05-01/backups/id_volume_test.go | 372 ----------- .../backups/method_accountbackupsdelete.go | 71 --- .../backups/method_accountbackupsget.go | 51 -- .../backups/method_accountbackupslist.go | 52 -- .../2022-05-01/backups/method_create.go | 75 --- .../2022-05-01/backups/method_delete.go | 71 --- .../netapp/2022-05-01/backups/method_get.go | 51 -- .../2022-05-01/backups/method_getstatus.go | 52 -- .../netapp/2022-05-01/backups/method_list.go | 52 -- .../2022-05-01/backups/method_update.go | 74 --- .../netapp/2022-05-01/backups/model_backup.go | 12 - .../2022-05-01/backups/model_backuppatch.go | 9 - .../backups/model_backupproperties.go | 34 - .../2022-05-01/backups/model_backupslist.go | 8 - .../2022-05-01/backups/model_backupstatus.go | 15 - .../netapp/2022-05-01/backups/version.go | 12 - .../netapp/2022-05-01/capacitypools/README.md | 99 --- .../netapp/2022-05-01/capacitypools/client.go | 26 - .../2022-05-01/capacitypools/constants.go | 139 ---- .../capacitypools/id_capacitypool.go | 134 ---- .../capacitypools/id_capacitypool_test.go | 327 ---------- .../capacitypools/id_netappaccount.go | 125 ---- .../capacitypools/id_netappaccount_test.go | 282 --------- .../method_poolscreateorupdate.go | 74 --- .../capacitypools/method_poolsdelete.go | 70 -- .../capacitypools/method_poolsget.go | 51 -- .../capacitypools/method_poolslist.go | 89 --- .../capacitypools/method_poolsupdate.go | 74 --- .../capacitypools/model_capacitypool.go | 19 - .../capacitypools/model_capacitypoolpatch.go | 13 - .../model_poolpatchproperties.go | 10 - .../capacitypools/model_poolproperties.go | 16 - .../2022-05-01/capacitypools/predicates.go | 37 -- .../2022-05-01/capacitypools/version.go | 12 - resource-manager/netapp/2022-05-01/client.go | 190 ------ .../2022-05-01/netappaccounts/README.md | 128 ---- .../2022-05-01/netappaccounts/client.go | 26 - .../2022-05-01/netappaccounts/constants.go | 151 ----- .../netappaccounts/id_netappaccount.go | 125 ---- .../netappaccounts/id_netappaccount_test.go | 282 --------- .../method_accountscreateorupdate.go | 74 --- .../netappaccounts/method_accountsdelete.go | 70 -- .../netappaccounts/method_accountsget.go | 51 -- .../netappaccounts/method_accountslist.go | 90 --- .../method_accountslistbysubscription.go | 90 --- .../method_accountsrenewcredentials.go | 70 -- .../netappaccounts/method_accountsupdate.go | 74 --- .../netappaccounts/model_accountencryption.go | 10 - .../netappaccounts/model_accountproperties.go | 11 - .../netappaccounts/model_activedirectory.go | 29 - .../model_encryptionidentity.go | 9 - .../model_keyvaultproperties.go | 12 - .../model_ldapsearchscopeopt.go | 10 - .../netappaccounts/model_netappaccount.go | 21 - .../model_netappaccountpatch.go | 13 - .../2022-05-01/netappaccounts/predicates.go | 37 -- .../2022-05-01/netappaccounts/version.go | 12 - .../2022-05-01/netappresource/README.md | 131 ---- .../2022-05-01/netappresource/client.go | 26 - .../2022-05-01/netappresource/constants.go | 192 ------ .../2022-05-01/netappresource/id_location.go | 116 ---- .../netappresource/id_location_test.go | 237 ------- .../netappresource/id_quotalimit.go | 125 ---- .../netappresource/id_quotalimit_test.go | 282 --------- .../method_checkfilepathavailability.go | 56 -- .../method_checknameavailability.go | 56 -- .../method_checkquotaavailability.go | 56 -- .../netappresource/method_queryregioninfo.go | 52 -- .../netappresource/method_quotalimitsget.go | 51 -- .../netappresource/method_quotalimitslist.go | 52 -- .../model_checkavailabilityresponse.go | 10 - .../model_filepathavailabilityrequest.go | 9 - .../model_quotaavailabilityrequest.go | 10 - .../netappresource/model_regioninfo.go | 9 - ...gioninfoavailabilityzonemappingsinlined.go | 9 - .../model_resourcenameavailabilityrequest.go | 10 - .../model_subscriptionquotaitem.go | 16 - .../model_subscriptionquotaitemlist.go | 8 - .../model_subscriptionquotaitemproperties.go | 9 - .../2022-05-01/netappresource/version.go | 12 - .../netapp/2022-05-01/poolchange/README.md | 37 -- .../netapp/2022-05-01/poolchange/client.go | 26 - .../netapp/2022-05-01/poolchange/id_volume.go | 143 ----- .../2022-05-01/poolchange/id_volume_test.go | 372 ----------- .../poolchange/method_volumespoolchange.go | 74 --- .../poolchange/model_poolchangerequest.go | 8 - .../netapp/2022-05-01/poolchange/version.go | 12 - .../2022-05-01/resetcifspassword/client.go | 26 - .../2022-05-01/resetcifspassword/id_volume.go | 143 ----- .../resetcifspassword/id_volume_test.go | 372 ----------- .../method_volumesresetcifspassword.go | 70 -- .../2022-05-01/resetcifspassword/version.go | 12 - .../netapp/2022-05-01/restore/README.md | 36 -- .../netapp/2022-05-01/restore/client.go | 26 - .../netapp/2022-05-01/restore/constants.go | 95 --- .../netapp/2022-05-01/restore/id_volume.go | 143 ----- .../2022-05-01/restore/id_volume_test.go | 372 ----------- .../method_backupsgetvolumerestorestatus.go | 52 -- .../2022-05-01/restore/model_restorestatus.go | 13 - .../netapp/2022-05-01/restore/version.go | 12 - .../2022-05-01/snapshotpolicy/README.md | 102 --- .../2022-05-01/snapshotpolicy/client.go | 26 - .../snapshotpolicy/id_netappaccount.go | 125 ---- .../snapshotpolicy/id_netappaccount_test.go | 282 --------- .../snapshotpolicy/id_snapshotpolicy.go | 134 ---- .../snapshotpolicy/id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpoliciescreate.go | 56 -- .../method_snapshotpoliciesdelete.go | 71 --- .../method_snapshotpoliciesget.go | 51 -- .../method_snapshotpolicieslist.go | 52 -- .../method_snapshotpoliciesupdate.go | 74 --- .../snapshotpolicy/model_dailyschedule.go | 11 - .../snapshotpolicy/model_hourlyschedule.go | 10 - .../snapshotpolicy/model_monthlyschedule.go | 12 - .../model_snapshotpolicieslist.go | 8 - .../snapshotpolicy/model_snapshotpolicy.go | 19 - .../model_snapshotpolicypatch.go | 13 - .../model_snapshotpolicyproperties.go | 13 - .../snapshotpolicy/model_weeklyschedule.go | 12 - .../2022-05-01/snapshotpolicy/version.go | 12 - .../snapshotpolicylistvolumes/README.md | 36 -- .../snapshotpolicylistvolumes/client.go | 26 - .../snapshotpolicylistvolumes/constants.go | 514 --------------- .../id_snapshotpolicy.go | 134 ---- .../id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpolicieslistvolumes.go | 52 -- .../model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../model_replicationobject.go | 12 - .../model_snapshotpolicyvolumelist.go | 8 - .../snapshotpolicylistvolumes/model_volume.go | 21 - .../model_volumebackupproperties.go | 11 - .../model_volumeproperties.go | 54 -- .../model_volumepropertiesdataprotection.go | 10 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumesnapshotproperties.go | 8 - .../snapshotpolicylistvolumes/version.go | 12 - .../netapp/2022-05-01/snapshots/README.md | 111 ---- .../netapp/2022-05-01/snapshots/client.go | 26 - .../2022-05-01/snapshots/id_snapshot.go | 152 ----- .../2022-05-01/snapshots/id_snapshot_test.go | 417 ------------ .../netapp/2022-05-01/snapshots/id_volume.go | 143 ----- .../2022-05-01/snapshots/id_volume_test.go | 372 ----------- .../2022-05-01/snapshots/method_create.go | 74 --- .../2022-05-01/snapshots/method_delete.go | 71 --- .../netapp/2022-05-01/snapshots/method_get.go | 51 -- .../2022-05-01/snapshots/method_list.go | 52 -- .../snapshots/method_restorefiles.go | 74 --- .../2022-05-01/snapshots/method_update.go | 74 --- .../2022-05-01/snapshots/model_snapshot.go | 12 - .../snapshots/model_snapshotproperties.go | 28 - .../snapshots/model_snapshotrestorefiles.go | 9 - .../snapshots/model_snapshotslist.go | 8 - .../netapp/2022-05-01/snapshots/version.go | 12 - .../netapp/2022-05-01/subvolumes/README.md | 111 ---- .../netapp/2022-05-01/subvolumes/client.go | 26 - .../2022-05-01/subvolumes/id_subvolume.go | 152 ----- .../subvolumes/id_subvolume_test.go | 417 ------------ .../netapp/2022-05-01/subvolumes/id_volume.go | 143 ----- .../2022-05-01/subvolumes/id_volume_test.go | 372 ----------- .../2022-05-01/subvolumes/method_create.go | 75 --- .../2022-05-01/subvolumes/method_delete.go | 71 --- .../2022-05-01/subvolumes/method_get.go | 51 -- .../subvolumes/method_getmetadata.go | 70 -- .../subvolumes/method_listbyvolume.go | 89 --- .../2022-05-01/subvolumes/method_update.go | 74 --- .../subvolumes/model_subvolumeinfo.go | 16 - .../subvolumes/model_subvolumemodel.go | 11 - .../model_subvolumemodelproperties.go | 71 --- .../subvolumes/model_subvolumepatchparams.go | 9 - .../subvolumes/model_subvolumepatchrequest.go | 8 - .../subvolumes/model_subvolumeproperties.go | 11 - .../2022-05-01/subvolumes/predicates.go | 27 - .../netapp/2022-05-01/subvolumes/version.go | 12 - .../netapp/2022-05-01/vaults/README.md | 36 -- .../netapp/2022-05-01/vaults/client.go | 26 - .../2022-05-01/vaults/id_netappaccount.go | 125 ---- .../vaults/id_netappaccount_test.go | 282 --------- .../netapp/2022-05-01/vaults/method_list.go | 52 -- .../netapp/2022-05-01/vaults/model_vault.go | 11 - .../2022-05-01/vaults/model_vaultlist.go | 8 - .../vaults/model_vaultproperties.go | 8 - .../netapp/2022-05-01/vaults/version.go | 12 - .../netapp/2022-05-01/volumegroups/README.md | 81 --- .../netapp/2022-05-01/volumegroups/client.go | 26 - .../2022-05-01/volumegroups/constants.go | 552 ---------------- .../volumegroups/id_netappaccount.go | 125 ---- .../volumegroups/id_netappaccount_test.go | 282 --------- .../2022-05-01/volumegroups/id_volumegroup.go | 134 ---- .../volumegroups/id_volumegroup_test.go | 327 ---------- .../2022-05-01/volumegroups/method_create.go | 73 --- .../2022-05-01/volumegroups/method_delete.go | 71 --- .../2022-05-01/volumegroups/method_get.go | 51 -- .../method_listbynetappaccount.go | 52 -- .../volumegroups/model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../volumegroups/model_replicationobject.go | 12 - .../model_volumebackupproperties.go | 11 - .../volumegroups/model_volumegroup.go | 12 - .../volumegroups/model_volumegroupdetails.go | 12 - .../volumegroups/model_volumegrouplist.go | 8 - .../model_volumegrouplistproperties.go | 9 - .../volumegroups/model_volumegroupmetadata.go | 13 - .../model_volumegroupproperties.go | 10 - .../model_volumegroupvolumeproperties.go | 12 - .../volumegroups/model_volumeproperties.go | 54 -- .../model_volumepropertiesdataprotection.go | 10 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumesnapshotproperties.go | 8 - .../netapp/2022-05-01/volumegroups/version.go | 12 - .../2022-05-01/volumequotarules/README.md | 98 --- .../2022-05-01/volumequotarules/client.go | 26 - .../2022-05-01/volumequotarules/constants.go | 113 ---- .../2022-05-01/volumequotarules/id_volume.go | 143 ----- .../volumequotarules/id_volume_test.go | 372 ----------- .../volumequotarules/id_volumequotarule.go | 152 ----- .../id_volumequotarule_test.go | 417 ------------ .../volumequotarules/method_create.go | 74 --- .../volumequotarules/method_delete.go | 70 -- .../2022-05-01/volumequotarules/method_get.go | 51 -- .../volumequotarules/method_listbyvolume.go | 52 -- .../volumequotarules/method_update.go | 74 --- .../volumequotarules/model_volumequotarule.go | 18 - .../model_volumequotarulepatch.go | 8 - .../model_volumequotaruleslist.go | 8 - .../model_volumequotarulesproperties.go | 11 - .../2022-05-01/volumequotarules/version.go | 12 - .../netapp/2022-05-01/volumes/README.md | 99 --- .../netapp/2022-05-01/volumes/client.go | 26 - .../netapp/2022-05-01/volumes/constants.go | 514 --------------- .../2022-05-01/volumes/id_capacitypool.go | 134 ---- .../volumes/id_capacitypool_test.go | 327 ---------- .../netapp/2022-05-01/volumes/id_volume.go | 143 ----- .../2022-05-01/volumes/id_volume_test.go | 372 ----------- .../volumes/method_createorupdate.go | 75 --- .../2022-05-01/volumes/method_delete.go | 98 --- .../netapp/2022-05-01/volumes/method_get.go | 51 -- .../netapp/2022-05-01/volumes/method_list.go | 89 --- .../2022-05-01/volumes/method_update.go | 74 --- .../volumes/model_exportpolicyrule.go | 22 - .../volumes/model_mounttargetproperties.go | 11 - .../volumes/model_placementkeyvaluepairs.go | 9 - .../volumes/model_replicationobject.go | 12 - .../netapp/2022-05-01/volumes/model_volume.go | 21 - .../volumes/model_volumebackupproperties.go | 11 - .../2022-05-01/volumes/model_volumepatch.go | 13 - .../volumes/model_volumepatchproperties.go | 18 - ...del_volumepatchpropertiesdataprotection.go | 9 - ...model_volumepatchpropertiesexportpolicy.go | 8 - .../volumes/model_volumeproperties.go | 54 -- .../model_volumepropertiesdataprotection.go | 10 - .../model_volumepropertiesexportpolicy.go | 8 - .../volumes/model_volumesnapshotproperties.go | 8 - .../netapp/2022-05-01/volumes/predicates.go | 37 -- .../netapp/2022-05-01/volumes/version.go | 12 - .../2022-05-01/volumesrelocation/README.md | 61 -- .../2022-05-01/volumesrelocation/client.go | 26 - .../2022-05-01/volumesrelocation/id_volume.go | 143 ----- .../volumesrelocation/id_volume_test.go | 372 ----------- .../method_volumesfinalizerelocation.go | 70 -- .../method_volumesrelocate.go | 74 --- .../method_volumesrevertrelocation.go | 70 -- .../model_relocatevolumerequest.go | 8 - .../2022-05-01/volumesrelocation/version.go | 12 - .../2022-05-01/volumesreplication/README.md | 139 ---- .../2022-05-01/volumesreplication/client.go | 26 - .../volumesreplication/constants.go | 180 ------ .../volumesreplication/id_volume.go | 143 ----- .../volumesreplication/id_volume_test.go | 372 ----------- .../method_volumesauthorizereplication.go | 74 --- .../method_volumesbreakreplication.go | 74 --- .../method_volumesdeletereplication.go | 70 -- .../method_volumeslistreplications.go | 52 -- .../method_volumesreestablishreplication.go | 73 --- .../method_volumesreinitializereplication.go | 70 -- .../method_volumesreplicationstatus.go | 52 -- .../method_volumesresyncreplication.go | 70 -- .../model_authorizerequest.go | 8 - .../model_breakreplicationrequest.go | 8 - .../model_listreplications.go | 8 - .../model_reestablishreplicationrequest.go | 8 - .../volumesreplication/model_replication.go | 11 - .../model_replicationstatus.go | 12 - .../2022-05-01/volumesreplication/version.go | 12 - .../netapp/2022-05-01/volumesrevert/README.md | 37 -- .../netapp/2022-05-01/volumesrevert/client.go | 26 - .../2022-05-01/volumesrevert/id_volume.go | 143 ----- .../volumesrevert/id_volume_test.go | 372 ----------- .../volumesrevert/method_volumesrevert.go | 74 --- .../volumesrevert/model_volumerevert.go | 8 - .../2022-05-01/volumesrevert/version.go | 12 - .../netapp/2022-09-01/backuppolicy/README.md | 98 --- .../netapp/2022-09-01/backuppolicy/client.go | 26 - .../backuppolicy/id_backuppolicy.go | 134 ---- .../backuppolicy/id_backuppolicy_test.go | 327 ---------- .../backuppolicy/id_netappaccount.go | 125 ---- .../backuppolicy/id_netappaccount_test.go | 282 --------- .../method_backuppoliciescreate.go | 75 --- .../method_backuppoliciesdelete.go | 71 --- .../backuppolicy/method_backuppoliciesget.go | 51 -- .../backuppolicy/method_backuppolicieslist.go | 52 -- .../method_backuppoliciesupdate.go | 74 --- .../backuppolicy/model_backuppolicieslist.go | 8 - .../backuppolicy/model_backuppolicy.go | 19 - .../backuppolicy/model_backuppolicypatch.go | 13 - .../model_backuppolicyproperties.go | 15 - .../backuppolicy/model_volumebackups.go | 10 - .../netapp/2022-09-01/backuppolicy/version.go | 12 - .../netapp/2022-09-01/backups/README.md | 175 ----- .../netapp/2022-09-01/backups/client.go | 26 - .../netapp/2022-09-01/backups/constants.go | 136 ---- .../2022-09-01/backups/id_accountbackup.go | 134 ---- .../backups/id_accountbackup_test.go | 327 ---------- .../netapp/2022-09-01/backups/id_backup.go | 152 ----- .../2022-09-01/backups/id_backup_test.go | 417 ------------ .../2022-09-01/backups/id_netappaccount.go | 125 ---- .../backups/id_netappaccount_test.go | 282 --------- .../netapp/2022-09-01/backups/id_volume.go | 143 ----- .../2022-09-01/backups/id_volume_test.go | 372 ----------- .../backups/method_accountbackupsdelete.go | 71 --- .../backups/method_accountbackupsget.go | 51 -- .../backups/method_accountbackupslist.go | 52 -- .../2022-09-01/backups/method_create.go | 75 --- .../2022-09-01/backups/method_delete.go | 71 --- .../netapp/2022-09-01/backups/method_get.go | 51 -- .../2022-09-01/backups/method_getstatus.go | 52 -- .../netapp/2022-09-01/backups/method_list.go | 52 -- .../2022-09-01/backups/method_restorefiles.go | 74 --- .../2022-09-01/backups/method_update.go | 74 --- .../netapp/2022-09-01/backups/model_backup.go | 17 - .../2022-09-01/backups/model_backuppatch.go | 9 - .../backups/model_backupproperties.go | 34 - .../backups/model_backuprestorefiles.go | 10 - .../2022-09-01/backups/model_backupslist.go | 8 - .../2022-09-01/backups/model_backupstatus.go | 15 - .../netapp/2022-09-01/backups/version.go | 12 - .../netapp/2022-09-01/capacitypools/README.md | 99 --- .../netapp/2022-09-01/capacitypools/client.go | 26 - .../2022-09-01/capacitypools/constants.go | 139 ---- .../capacitypools/id_capacitypool.go | 134 ---- .../capacitypools/id_capacitypool_test.go | 327 ---------- .../capacitypools/id_netappaccount.go | 125 ---- .../capacitypools/id_netappaccount_test.go | 282 --------- .../method_poolscreateorupdate.go | 74 --- .../capacitypools/method_poolsdelete.go | 70 -- .../capacitypools/method_poolsget.go | 51 -- .../capacitypools/method_poolslist.go | 89 --- .../capacitypools/method_poolsupdate.go | 74 --- .../capacitypools/model_capacitypool.go | 19 - .../capacitypools/model_capacitypoolpatch.go | 13 - .../model_poolpatchproperties.go | 10 - .../capacitypools/model_poolproperties.go | 16 - .../2022-09-01/capacitypools/predicates.go | 37 -- .../2022-09-01/capacitypools/version.go | 12 - resource-manager/netapp/2022-09-01/client.go | 190 ------ .../netapp/2022-09-01/filelocks/README.md | 37 -- .../netapp/2022-09-01/filelocks/client.go | 26 - .../netapp/2022-09-01/filelocks/id_volume.go | 143 ----- .../2022-09-01/filelocks/id_volume_test.go | 372 ----------- .../filelocks/method_volumesbreakfilelocks.go | 74 --- .../filelocks/model_breakfilelocksrequest.go | 9 - .../netapp/2022-09-01/filelocks/version.go | 12 - .../2022-09-01/netappaccounts/README.md | 128 ---- .../2022-09-01/netappaccounts/client.go | 26 - .../2022-09-01/netappaccounts/constants.go | 151 ----- .../netappaccounts/id_netappaccount.go | 125 ---- .../netappaccounts/id_netappaccount_test.go | 282 --------- .../method_accountscreateorupdate.go | 74 --- .../netappaccounts/method_accountsdelete.go | 70 -- .../netappaccounts/method_accountsget.go | 51 -- .../netappaccounts/method_accountslist.go | 90 --- .../method_accountslistbysubscription.go | 90 --- .../method_accountsrenewcredentials.go | 70 -- .../netappaccounts/method_accountsupdate.go | 74 --- .../netappaccounts/model_accountencryption.go | 10 - .../netappaccounts/model_accountproperties.go | 11 - .../netappaccounts/model_activedirectory.go | 30 - .../model_encryptionidentity.go | 9 - .../model_keyvaultproperties.go | 12 - .../model_ldapsearchscopeopt.go | 10 - .../netappaccounts/model_netappaccount.go | 21 - .../model_netappaccountpatch.go | 13 - .../2022-09-01/netappaccounts/predicates.go | 37 -- .../2022-09-01/netappaccounts/version.go | 12 - .../2022-09-01/netappresource/README.md | 131 ---- .../2022-09-01/netappresource/client.go | 26 - .../2022-09-01/netappresource/constants.go | 192 ------ .../2022-09-01/netappresource/id_location.go | 116 ---- .../netappresource/id_location_test.go | 237 ------- .../netappresource/id_quotalimit.go | 125 ---- .../netappresource/id_quotalimit_test.go | 282 --------- .../method_checkfilepathavailability.go | 56 -- .../method_checknameavailability.go | 56 -- .../method_checkquotaavailability.go | 56 -- .../netappresource/method_queryregioninfo.go | 52 -- .../netappresource/method_quotalimitsget.go | 51 -- .../netappresource/method_quotalimitslist.go | 52 -- .../model_checkavailabilityresponse.go | 10 - .../model_filepathavailabilityrequest.go | 9 - .../model_quotaavailabilityrequest.go | 10 - .../netappresource/model_regioninfo.go | 9 - ...gioninfoavailabilityzonemappingsinlined.go | 9 - .../model_resourcenameavailabilityrequest.go | 10 - .../model_subscriptionquotaitem.go | 16 - .../model_subscriptionquotaitemlist.go | 8 - .../model_subscriptionquotaitemproperties.go | 9 - .../2022-09-01/netappresource/version.go | 12 - .../netapp/2022-09-01/poolchange/README.md | 37 -- .../netapp/2022-09-01/poolchange/client.go | 26 - .../netapp/2022-09-01/poolchange/id_volume.go | 143 ----- .../2022-09-01/poolchange/id_volume_test.go | 372 ----------- .../poolchange/method_volumespoolchange.go | 74 --- .../poolchange/model_poolchangerequest.go | 8 - .../netapp/2022-09-01/poolchange/version.go | 12 - .../2022-09-01/resetcifspassword/client.go | 26 - .../2022-09-01/resetcifspassword/id_volume.go | 143 ----- .../resetcifspassword/id_volume_test.go | 372 ----------- .../method_volumesresetcifspassword.go | 70 -- .../2022-09-01/resetcifspassword/version.go | 12 - .../netapp/2022-09-01/restore/README.md | 36 -- .../netapp/2022-09-01/restore/client.go | 26 - .../netapp/2022-09-01/restore/constants.go | 95 --- .../netapp/2022-09-01/restore/id_volume.go | 143 ----- .../2022-09-01/restore/id_volume_test.go | 372 ----------- .../method_backupsgetvolumerestorestatus.go | 52 -- .../2022-09-01/restore/model_restorestatus.go | 13 - .../netapp/2022-09-01/restore/version.go | 12 - .../2022-09-01/snapshotpolicy/README.md | 102 --- .../2022-09-01/snapshotpolicy/client.go | 26 - .../snapshotpolicy/id_netappaccount.go | 125 ---- .../snapshotpolicy/id_netappaccount_test.go | 282 --------- .../snapshotpolicy/id_snapshotpolicy.go | 134 ---- .../snapshotpolicy/id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpoliciescreate.go | 56 -- .../method_snapshotpoliciesdelete.go | 71 --- .../method_snapshotpoliciesget.go | 51 -- .../method_snapshotpolicieslist.go | 52 -- .../method_snapshotpoliciesupdate.go | 74 --- .../snapshotpolicy/model_dailyschedule.go | 11 - .../snapshotpolicy/model_hourlyschedule.go | 10 - .../snapshotpolicy/model_monthlyschedule.go | 12 - .../model_snapshotpolicieslist.go | 8 - .../snapshotpolicy/model_snapshotpolicy.go | 19 - .../model_snapshotpolicypatch.go | 13 - .../model_snapshotpolicyproperties.go | 13 - .../snapshotpolicy/model_weeklyschedule.go | 12 - .../2022-09-01/snapshotpolicy/version.go | 12 - .../snapshotpolicylistvolumes/README.md | 36 -- .../snapshotpolicylistvolumes/client.go | 26 - .../snapshotpolicylistvolumes/constants.go | 555 ---------------- .../id_snapshotpolicy.go | 134 ---- .../id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpolicieslistvolumes.go | 52 -- .../model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../model_replicationobject.go | 12 - .../model_snapshotpolicyvolumelist.go | 8 - .../snapshotpolicylistvolumes/model_volume.go | 21 - .../model_volumebackupproperties.go | 10 - .../model_volumeproperties.go | 58 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../model_volumesnapshotproperties.go | 8 - .../snapshotpolicylistvolumes/version.go | 12 - .../netapp/2022-09-01/snapshots/README.md | 111 ---- .../netapp/2022-09-01/snapshots/client.go | 26 - .../2022-09-01/snapshots/id_snapshot.go | 152 ----- .../2022-09-01/snapshots/id_snapshot_test.go | 417 ------------ .../netapp/2022-09-01/snapshots/id_volume.go | 143 ----- .../2022-09-01/snapshots/id_volume_test.go | 372 ----------- .../2022-09-01/snapshots/method_create.go | 74 --- .../2022-09-01/snapshots/method_delete.go | 71 --- .../netapp/2022-09-01/snapshots/method_get.go | 51 -- .../2022-09-01/snapshots/method_list.go | 52 -- .../snapshots/method_restorefiles.go | 74 --- .../2022-09-01/snapshots/method_update.go | 74 --- .../2022-09-01/snapshots/model_snapshot.go | 17 - .../snapshots/model_snapshotproperties.go | 28 - .../snapshots/model_snapshotrestorefiles.go | 9 - .../snapshots/model_snapshotslist.go | 8 - .../netapp/2022-09-01/snapshots/version.go | 12 - .../netapp/2022-09-01/subvolumes/README.md | 111 ---- .../netapp/2022-09-01/subvolumes/client.go | 26 - .../2022-09-01/subvolumes/id_subvolume.go | 152 ----- .../subvolumes/id_subvolume_test.go | 417 ------------ .../netapp/2022-09-01/subvolumes/id_volume.go | 143 ----- .../2022-09-01/subvolumes/id_volume_test.go | 372 ----------- .../2022-09-01/subvolumes/method_create.go | 75 --- .../2022-09-01/subvolumes/method_delete.go | 71 --- .../2022-09-01/subvolumes/method_get.go | 51 -- .../subvolumes/method_getmetadata.go | 70 -- .../subvolumes/method_listbyvolume.go | 89 --- .../2022-09-01/subvolumes/method_update.go | 74 --- .../subvolumes/model_subvolumeinfo.go | 16 - .../subvolumes/model_subvolumemodel.go | 11 - .../model_subvolumemodelproperties.go | 71 --- .../subvolumes/model_subvolumepatchparams.go | 9 - .../subvolumes/model_subvolumepatchrequest.go | 8 - .../subvolumes/model_subvolumeproperties.go | 11 - .../2022-09-01/subvolumes/predicates.go | 27 - .../netapp/2022-09-01/subvolumes/version.go | 12 - .../netapp/2022-09-01/volumegroups/README.md | 81 --- .../netapp/2022-09-01/volumegroups/client.go | 26 - .../2022-09-01/volumegroups/constants.go | 593 ----------------- .../volumegroups/id_netappaccount.go | 125 ---- .../volumegroups/id_netappaccount_test.go | 282 --------- .../2022-09-01/volumegroups/id_volumegroup.go | 134 ---- .../volumegroups/id_volumegroup_test.go | 327 ---------- .../2022-09-01/volumegroups/method_create.go | 73 --- .../2022-09-01/volumegroups/method_delete.go | 71 --- .../2022-09-01/volumegroups/method_get.go | 51 -- .../method_listbynetappaccount.go | 52 -- .../volumegroups/model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../volumegroups/model_replicationobject.go | 12 - .../model_volumebackupproperties.go | 10 - .../volumegroups/model_volumegroup.go | 12 - .../volumegroups/model_volumegroupdetails.go | 12 - .../volumegroups/model_volumegrouplist.go | 8 - .../model_volumegrouplistproperties.go | 9 - .../volumegroups/model_volumegroupmetadata.go | 13 - .../model_volumegroupproperties.go | 10 - .../model_volumegroupvolumeproperties.go | 12 - .../volumegroups/model_volumeproperties.go | 58 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../model_volumesnapshotproperties.go | 8 - .../netapp/2022-09-01/volumegroups/version.go | 12 - .../2022-09-01/volumequotarules/README.md | 98 --- .../2022-09-01/volumequotarules/client.go | 26 - .../2022-09-01/volumequotarules/constants.go | 113 ---- .../2022-09-01/volumequotarules/id_volume.go | 143 ----- .../volumequotarules/id_volume_test.go | 372 ----------- .../volumequotarules/id_volumequotarule.go | 152 ----- .../id_volumequotarule_test.go | 417 ------------ .../volumequotarules/method_create.go | 74 --- .../volumequotarules/method_delete.go | 71 --- .../2022-09-01/volumequotarules/method_get.go | 51 -- .../volumequotarules/method_listbyvolume.go | 52 -- .../volumequotarules/method_update.go | 74 --- .../volumequotarules/model_volumequotarule.go | 18 - .../model_volumequotarulepatch.go | 9 - .../model_volumequotaruleslist.go | 8 - .../model_volumequotarulesproperties.go | 11 - .../2022-09-01/volumequotarules/version.go | 12 - .../netapp/2022-09-01/volumes/README.md | 99 --- .../netapp/2022-09-01/volumes/client.go | 26 - .../netapp/2022-09-01/volumes/constants.go | 555 ---------------- .../2022-09-01/volumes/id_capacitypool.go | 134 ---- .../volumes/id_capacitypool_test.go | 327 ---------- .../netapp/2022-09-01/volumes/id_volume.go | 143 ----- .../2022-09-01/volumes/id_volume_test.go | 372 ----------- .../volumes/method_createorupdate.go | 75 --- .../2022-09-01/volumes/method_delete.go | 98 --- .../netapp/2022-09-01/volumes/method_get.go | 51 -- .../netapp/2022-09-01/volumes/method_list.go | 89 --- .../2022-09-01/volumes/method_update.go | 74 --- .../volumes/model_exportpolicyrule.go | 22 - .../volumes/model_mounttargetproperties.go | 11 - .../volumes/model_placementkeyvaluepairs.go | 9 - .../volumes/model_replicationobject.go | 12 - .../netapp/2022-09-01/volumes/model_volume.go | 21 - .../volumes/model_volumebackupproperties.go | 10 - .../2022-09-01/volumes/model_volumepatch.go | 13 - .../volumes/model_volumepatchproperties.go | 18 - ...del_volumepatchpropertiesdataprotection.go | 9 - ...model_volumepatchpropertiesexportpolicy.go | 8 - .../volumes/model_volumeproperties.go | 58 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../volumes/model_volumesnapshotproperties.go | 8 - .../netapp/2022-09-01/volumes/predicates.go | 37 -- .../netapp/2022-09-01/volumes/version.go | 12 - .../2022-09-01/volumesrelocation/README.md | 61 -- .../2022-09-01/volumesrelocation/client.go | 26 - .../2022-09-01/volumesrelocation/id_volume.go | 143 ----- .../volumesrelocation/id_volume_test.go | 372 ----------- .../method_volumesfinalizerelocation.go | 70 -- .../method_volumesrelocate.go | 74 --- .../method_volumesrevertrelocation.go | 70 -- .../model_relocatevolumerequest.go | 8 - .../2022-09-01/volumesrelocation/version.go | 12 - .../2022-09-01/volumesreplication/README.md | 139 ---- .../2022-09-01/volumesreplication/client.go | 26 - .../volumesreplication/constants.go | 180 ------ .../volumesreplication/id_volume.go | 143 ----- .../volumesreplication/id_volume_test.go | 372 ----------- .../method_volumesauthorizereplication.go | 74 --- .../method_volumesbreakreplication.go | 74 --- .../method_volumesdeletereplication.go | 70 -- .../method_volumeslistreplications.go | 52 -- .../method_volumesreestablishreplication.go | 73 --- .../method_volumesreinitializereplication.go | 70 -- .../method_volumesreplicationstatus.go | 52 -- .../method_volumesresyncreplication.go | 70 -- .../model_authorizerequest.go | 8 - .../model_breakreplicationrequest.go | 8 - .../model_listreplications.go | 8 - .../model_reestablishreplicationrequest.go | 8 - .../volumesreplication/model_replication.go | 11 - .../model_replicationstatus.go | 12 - .../2022-09-01/volumesreplication/version.go | 12 - .../netapp/2022-09-01/volumesrevert/README.md | 37 -- .../netapp/2022-09-01/volumesrevert/client.go | 26 - .../2022-09-01/volumesrevert/id_volume.go | 143 ----- .../volumesrevert/id_volume_test.go | 372 ----------- .../volumesrevert/method_volumesrevert.go | 74 --- .../volumesrevert/model_volumerevert.go | 8 - .../2022-09-01/volumesrevert/version.go | 12 - .../2022-11-01-preview/backuppolicy/README.md | 98 --- .../2022-11-01-preview/backuppolicy/client.go | 26 - .../backuppolicy/id_backuppolicy.go | 134 ---- .../backuppolicy/id_backuppolicy_test.go | 327 ---------- .../backuppolicy/id_netappaccount.go | 125 ---- .../backuppolicy/id_netappaccount_test.go | 282 --------- .../method_backuppoliciescreate.go | 75 --- .../method_backuppoliciesdelete.go | 71 --- .../backuppolicy/method_backuppoliciesget.go | 51 -- .../backuppolicy/method_backuppolicieslist.go | 52 -- .../method_backuppoliciesupdate.go | 74 --- .../backuppolicy/model_backuppolicieslist.go | 8 - .../backuppolicy/model_backuppolicy.go | 19 - .../backuppolicy/model_backuppolicypatch.go | 13 - .../model_backuppolicyproperties.go | 15 - .../backuppolicy/model_volumebackups.go | 10 - .../backuppolicy/version.go | 12 - .../2022-11-01-preview/backups/README.md | 210 ------ .../2022-11-01-preview/backups/client.go | 26 - .../2022-11-01-preview/backups/constants.go | 136 ---- .../backups/id_accountbackup.go | 134 ---- .../backups/id_accountbackup_test.go | 327 ---------- .../2022-11-01-preview/backups/id_backup.go | 143 ----- .../backups/id_backup_test.go | 372 ----------- .../backups/id_backupvault.go | 134 ---- .../backups/id_backupvault_test.go | 327 ---------- .../backups/id_netappaccount.go | 125 ---- .../backups/id_netappaccount_test.go | 282 --------- .../2022-11-01-preview/backups/id_volume.go | 143 ----- .../backups/id_volume_test.go | 372 ----------- .../backups/method_accountbackupsdelete.go | 71 --- .../backups/method_accountbackupsget.go | 51 -- ...ethod_accountbackupslistbynetappaccount.go | 80 --- .../backups/method_create.go | 75 --- .../backups/method_delete.go | 71 --- .../2022-11-01-preview/backups/method_get.go | 51 -- .../backups/method_getlateststatus.go | 52 -- .../backups/method_listbyvault.go | 117 ---- .../method_underaccountmigratebackups.go | 74 --- .../method_underbackupvaultrestorefiles.go | 74 --- .../method_undervolumemigratebackups.go | 74 --- .../backups/method_update.go | 74 --- .../backups/model_backup.go | 16 - .../backups/model_backuppatch.go | 8 - .../backups/model_backuppatchproperties.go | 8 - .../backups/model_backupproperties.go | 35 - .../backups/model_backuprestorefiles.go | 10 - .../backups/model_backupslist.go | 9 - .../backups/model_backupsmigrationrequest.go | 8 - .../backups/model_backupstatus.go | 16 - .../2022-11-01-preview/backups/predicates.go | 27 - .../2022-11-01-preview/backups/version.go | 12 - .../2022-11-01-preview/backupvaults/README.md | 99 --- .../2022-11-01-preview/backupvaults/client.go | 26 - .../backupvaults/id_backupvault.go | 134 ---- .../backupvaults/id_backupvault_test.go | 327 ---------- .../backupvaults/id_netappaccount.go | 125 ---- .../backupvaults/id_netappaccount_test.go | 282 --------- .../backupvaults/method_createorupdate.go | 74 --- .../backupvaults/method_delete.go | 71 --- .../backupvaults/method_get.go | 51 -- .../method_listbynetappaccount.go | 89 --- .../backupvaults/method_update.go | 74 --- .../backupvaults/model_backupvault.go | 18 - .../backupvaults/model_backupvaultpatch.go | 8 - .../model_backupvaultproperties.go | 8 - .../backupvaults/predicates.go | 32 - .../backupvaults/version.go | 12 - .../capacitypools/README.md | 99 --- .../capacitypools/client.go | 26 - .../capacitypools/constants.go | 139 ---- .../capacitypools/id_capacitypool.go | 134 ---- .../capacitypools/id_capacitypool_test.go | 327 ---------- .../capacitypools/id_netappaccount.go | 125 ---- .../capacitypools/id_netappaccount_test.go | 282 --------- .../method_poolscreateorupdate.go | 74 --- .../capacitypools/method_poolsdelete.go | 70 -- .../capacitypools/method_poolsget.go | 51 -- .../capacitypools/method_poolslist.go | 89 --- .../capacitypools/method_poolsupdate.go | 74 --- .../capacitypools/model_capacitypool.go | 19 - .../capacitypools/model_capacitypoolpatch.go | 13 - .../model_poolpatchproperties.go | 10 - .../capacitypools/model_poolproperties.go | 16 - .../capacitypools/predicates.go | 37 -- .../capacitypools/version.go | 12 - .../netapp/2022-11-01-preview/client.go | 208 ------ .../2022-11-01-preview/filelocks/README.md | 37 -- .../2022-11-01-preview/filelocks/client.go | 26 - .../2022-11-01-preview/filelocks/id_volume.go | 143 ----- .../filelocks/id_volume_test.go | 372 ----------- .../filelocks/method_volumesbreakfilelocks.go | 74 --- .../filelocks/model_breakfilelocksrequest.go | 9 - .../2022-11-01-preview/filelocks/version.go | 12 - .../groupidlistforldapuser/README.md | 37 -- .../groupidlistforldapuser/client.go | 26 - .../groupidlistforldapuser/id_volume.go | 143 ----- .../groupidlistforldapuser/id_volume_test.go | 372 ----------- ...od_volumeslistgetgroupidlistforldapuser.go | 74 --- .../model_getgroupidlistforldapuserrequest.go | 8 - ...model_getgroupidlistforldapuserresponse.go | 8 - .../groupidlistforldapuser/version.go | 12 - .../netappaccounts/README.md | 128 ---- .../netappaccounts/client.go | 26 - .../netappaccounts/constants.go | 151 ----- .../netappaccounts/id_netappaccount.go | 125 ---- .../netappaccounts/id_netappaccount_test.go | 282 --------- .../method_accountscreateorupdate.go | 74 --- .../netappaccounts/method_accountsdelete.go | 70 -- .../netappaccounts/method_accountsget.go | 51 -- .../netappaccounts/method_accountslist.go | 90 --- .../method_accountslistbysubscription.go | 90 --- .../method_accountsrenewcredentials.go | 70 -- .../netappaccounts/method_accountsupdate.go | 74 --- .../netappaccounts/model_accountencryption.go | 10 - .../netappaccounts/model_accountproperties.go | 11 - .../netappaccounts/model_activedirectory.go | 30 - .../model_encryptionidentity.go | 9 - .../model_keyvaultproperties.go | 12 - .../model_ldapsearchscopeopt.go | 10 - .../netappaccounts/model_netappaccount.go | 21 - .../model_netappaccountpatch.go | 18 - .../netappaccounts/predicates.go | 37 -- .../netappaccounts/version.go | 12 - .../netappresource/README.md | 131 ---- .../netappresource/client.go | 26 - .../netappresource/constants.go | 204 ------ .../netappresource/id_location.go | 116 ---- .../netappresource/id_location_test.go | 237 ------- .../netappresource/id_quotalimit.go | 125 ---- .../netappresource/id_quotalimit_test.go | 282 --------- .../method_checkfilepathavailability.go | 56 -- .../method_checknameavailability.go | 56 -- .../method_checkquotaavailability.go | 56 -- .../netappresource/method_queryregioninfo.go | 52 -- .../netappresource/method_quotalimitsget.go | 51 -- .../netappresource/method_quotalimitslist.go | 52 -- .../model_checkavailabilityresponse.go | 10 - .../model_filepathavailabilityrequest.go | 9 - .../model_quotaavailabilityrequest.go | 10 - .../netappresource/model_regioninfo.go | 9 - ...gioninfoavailabilityzonemappingsinlined.go | 9 - .../model_resourcenameavailabilityrequest.go | 10 - .../model_subscriptionquotaitem.go | 16 - .../model_subscriptionquotaitemlist.go | 8 - .../model_subscriptionquotaitemproperties.go | 9 - .../netappresource/version.go | 12 - .../2022-11-01-preview/poolchange/README.md | 37 -- .../2022-11-01-preview/poolchange/client.go | 26 - .../poolchange/id_volume.go | 143 ----- .../poolchange/id_volume_test.go | 372 ----------- .../poolchange/method_volumespoolchange.go | 74 --- .../poolchange/model_poolchangerequest.go | 8 - .../2022-11-01-preview/poolchange/version.go | 12 - .../resetcifspassword/client.go | 26 - .../resetcifspassword/id_volume.go | 143 ----- .../resetcifspassword/id_volume_test.go | 372 ----------- .../method_volumesresetcifspassword.go | 70 -- .../resetcifspassword/version.go | 12 - .../2022-11-01-preview/restore/README.md | 36 -- .../2022-11-01-preview/restore/client.go | 26 - .../2022-11-01-preview/restore/constants.go | 95 --- .../2022-11-01-preview/restore/id_volume.go | 143 ----- .../restore/id_volume_test.go | 372 ----------- .../method_backupsgetvolumerestorestatus.go | 52 -- .../restore/model_restorestatus.go | 13 - .../2022-11-01-preview/restore/version.go | 12 - .../snapshotpolicy/README.md | 102 --- .../snapshotpolicy/client.go | 26 - .../snapshotpolicy/id_netappaccount.go | 125 ---- .../snapshotpolicy/id_netappaccount_test.go | 282 --------- .../snapshotpolicy/id_snapshotpolicy.go | 134 ---- .../snapshotpolicy/id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpoliciescreate.go | 56 -- .../method_snapshotpoliciesdelete.go | 71 --- .../method_snapshotpoliciesget.go | 51 -- .../method_snapshotpolicieslist.go | 52 -- .../method_snapshotpoliciesupdate.go | 74 --- .../snapshotpolicy/model_dailyschedule.go | 11 - .../snapshotpolicy/model_hourlyschedule.go | 10 - .../snapshotpolicy/model_monthlyschedule.go | 12 - .../model_snapshotpolicieslist.go | 8 - .../snapshotpolicy/model_snapshotpolicy.go | 19 - .../model_snapshotpolicypatch.go | 13 - .../model_snapshotpolicyproperties.go | 13 - .../snapshotpolicy/model_weeklyschedule.go | 12 - .../snapshotpolicy/version.go | 12 - .../snapshotpolicylistvolumes/README.md | 36 -- .../snapshotpolicylistvolumes/client.go | 26 - .../snapshotpolicylistvolumes/constants.go | 558 ---------------- .../id_snapshotpolicy.go | 134 ---- .../id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpolicieslistvolumes.go | 52 -- .../model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../model_replicationobject.go | 12 - .../model_snapshotpolicyvolumelist.go | 8 - .../snapshotpolicylistvolumes/model_volume.go | 21 - .../model_volumebackupproperties.go | 11 - .../model_volumeproperties.go | 60 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../model_volumesnapshotproperties.go | 8 - .../snapshotpolicylistvolumes/version.go | 12 - .../2022-11-01-preview/snapshots/README.md | 111 ---- .../2022-11-01-preview/snapshots/client.go | 26 - .../snapshots/id_snapshot.go | 152 ----- .../snapshots/id_snapshot_test.go | 417 ------------ .../2022-11-01-preview/snapshots/id_volume.go | 143 ----- .../snapshots/id_volume_test.go | 372 ----------- .../snapshots/method_create.go | 74 --- .../snapshots/method_delete.go | 71 --- .../snapshots/method_get.go | 51 -- .../snapshots/method_list.go | 52 -- .../snapshots/method_restorefiles.go | 74 --- .../snapshots/method_update.go | 74 --- .../snapshots/model_snapshot.go | 17 - .../snapshots/model_snapshotproperties.go | 28 - .../snapshots/model_snapshotrestorefiles.go | 9 - .../snapshots/model_snapshotslist.go | 8 - .../2022-11-01-preview/snapshots/version.go | 12 - .../2022-11-01-preview/subvolumes/README.md | 111 ---- .../2022-11-01-preview/subvolumes/client.go | 26 - .../subvolumes/id_subvolume.go | 152 ----- .../subvolumes/id_subvolume_test.go | 417 ------------ .../subvolumes/id_volume.go | 143 ----- .../subvolumes/id_volume_test.go | 372 ----------- .../subvolumes/method_create.go | 75 --- .../subvolumes/method_delete.go | 71 --- .../subvolumes/method_get.go | 51 -- .../subvolumes/method_getmetadata.go | 70 -- .../subvolumes/method_listbyvolume.go | 89 --- .../subvolumes/method_update.go | 74 --- .../subvolumes/model_subvolumeinfo.go | 16 - .../subvolumes/model_subvolumemodel.go | 11 - .../model_subvolumemodelproperties.go | 71 --- .../subvolumes/model_subvolumepatchparams.go | 9 - .../subvolumes/model_subvolumepatchrequest.go | 8 - .../subvolumes/model_subvolumeproperties.go | 11 - .../subvolumes/predicates.go | 27 - .../2022-11-01-preview/subvolumes/version.go | 12 - .../2022-11-01-preview/volumegroups/README.md | 81 --- .../2022-11-01-preview/volumegroups/client.go | 26 - .../volumegroups/constants.go | 596 ------------------ .../volumegroups/id_netappaccount.go | 125 ---- .../volumegroups/id_netappaccount_test.go | 282 --------- .../volumegroups/id_volumegroup.go | 134 ---- .../volumegroups/id_volumegroup_test.go | 327 ---------- .../volumegroups/method_create.go | 73 --- .../volumegroups/method_delete.go | 71 --- .../volumegroups/method_get.go | 51 -- .../method_listbynetappaccount.go | 52 -- .../volumegroups/model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../volumegroups/model_replicationobject.go | 12 - .../model_volumebackupproperties.go | 11 - .../volumegroups/model_volumegroup.go | 12 - .../volumegroups/model_volumegroupdetails.go | 12 - .../volumegroups/model_volumegrouplist.go | 8 - .../model_volumegrouplistproperties.go | 9 - .../volumegroups/model_volumegroupmetadata.go | 13 - .../model_volumegroupproperties.go | 10 - .../model_volumegroupvolumeproperties.go | 12 - .../volumegroups/model_volumeproperties.go | 60 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../model_volumesnapshotproperties.go | 8 - .../volumegroups/version.go | 12 - .../volumequotarules/README.md | 98 --- .../volumequotarules/client.go | 26 - .../volumequotarules/constants.go | 113 ---- .../volumequotarules/id_volume.go | 143 ----- .../volumequotarules/id_volume_test.go | 372 ----------- .../volumequotarules/id_volumequotarule.go | 152 ----- .../id_volumequotarule_test.go | 417 ------------ .../volumequotarules/method_create.go | 74 --- .../volumequotarules/method_delete.go | 71 --- .../volumequotarules/method_get.go | 51 -- .../volumequotarules/method_listbyvolume.go | 52 -- .../volumequotarules/method_update.go | 74 --- .../volumequotarules/model_volumequotarule.go | 18 - .../model_volumequotarulepatch.go | 9 - .../model_volumequotaruleslist.go | 8 - .../model_volumequotarulesproperties.go | 11 - .../volumequotarules/version.go | 12 - .../2022-11-01-preview/volumes/README.md | 99 --- .../2022-11-01-preview/volumes/client.go | 26 - .../2022-11-01-preview/volumes/constants.go | 558 ---------------- .../volumes/id_capacitypool.go | 134 ---- .../volumes/id_capacitypool_test.go | 327 ---------- .../2022-11-01-preview/volumes/id_volume.go | 143 ----- .../volumes/id_volume_test.go | 372 ----------- .../volumes/method_createorupdate.go | 75 --- .../volumes/method_delete.go | 98 --- .../2022-11-01-preview/volumes/method_get.go | 51 -- .../2022-11-01-preview/volumes/method_list.go | 89 --- .../volumes/method_update.go | 74 --- .../volumes/model_exportpolicyrule.go | 22 - .../volumes/model_mounttargetproperties.go | 11 - .../volumes/model_placementkeyvaluepairs.go | 9 - .../volumes/model_replicationobject.go | 12 - .../volumes/model_volume.go | 21 - .../volumes/model_volumebackupproperties.go | 11 - .../volumes/model_volumepatch.go | 13 - .../volumes/model_volumepatchproperties.go | 21 - ...del_volumepatchpropertiesdataprotection.go | 9 - ...model_volumepatchpropertiesexportpolicy.go | 8 - .../volumes/model_volumeproperties.go | 60 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../volumes/model_volumesnapshotproperties.go | 8 - .../2022-11-01-preview/volumes/predicates.go | 37 -- .../2022-11-01-preview/volumes/version.go | 12 - .../volumesrelocation/README.md | 61 -- .../volumesrelocation/client.go | 26 - .../volumesrelocation/id_volume.go | 143 ----- .../volumesrelocation/id_volume_test.go | 372 ----------- .../method_volumesfinalizerelocation.go | 70 -- .../method_volumesrelocate.go | 74 --- .../method_volumesrevertrelocation.go | 70 -- .../model_relocatevolumerequest.go | 8 - .../volumesrelocation/version.go | 12 - .../volumesreplication/README.md | 139 ---- .../volumesreplication/client.go | 26 - .../volumesreplication/constants.go | 180 ------ .../volumesreplication/id_volume.go | 143 ----- .../volumesreplication/id_volume_test.go | 372 ----------- .../method_volumesauthorizereplication.go | 74 --- .../method_volumesbreakreplication.go | 74 --- .../method_volumesdeletereplication.go | 70 -- .../method_volumeslistreplications.go | 52 -- .../method_volumesreestablishreplication.go | 73 --- .../method_volumesreinitializereplication.go | 70 -- .../method_volumesreplicationstatus.go | 52 -- .../method_volumesresyncreplication.go | 70 -- .../model_authorizerequest.go | 8 - .../model_breakreplicationrequest.go | 8 - .../model_listreplications.go | 8 - .../model_reestablishreplicationrequest.go | 8 - .../volumesreplication/model_replication.go | 11 - .../model_replicationstatus.go | 12 - .../volumesreplication/version.go | 12 - .../volumesrevert/README.md | 37 -- .../volumesrevert/client.go | 26 - .../volumesrevert/id_volume.go | 143 ----- .../volumesrevert/id_volume_test.go | 372 ----------- .../volumesrevert/method_volumesrevert.go | 74 --- .../volumesrevert/model_volumerevert.go | 8 - .../volumesrevert/version.go | 12 - .../netapp/2022-11-01/backuppolicy/README.md | 98 --- .../netapp/2022-11-01/backuppolicy/client.go | 26 - .../backuppolicy/id_backuppolicy.go | 134 ---- .../backuppolicy/id_backuppolicy_test.go | 327 ---------- .../backuppolicy/id_netappaccount.go | 125 ---- .../backuppolicy/id_netappaccount_test.go | 282 --------- .../method_backuppoliciescreate.go | 75 --- .../method_backuppoliciesdelete.go | 71 --- .../backuppolicy/method_backuppoliciesget.go | 51 -- .../backuppolicy/method_backuppolicieslist.go | 52 -- .../method_backuppoliciesupdate.go | 74 --- .../backuppolicy/model_backuppolicieslist.go | 8 - .../backuppolicy/model_backuppolicy.go | 19 - .../backuppolicy/model_backuppolicypatch.go | 13 - .../model_backuppolicyproperties.go | 15 - .../backuppolicy/model_volumebackups.go | 10 - .../netapp/2022-11-01/backuppolicy/version.go | 12 - .../netapp/2022-11-01/backups/README.md | 175 ----- .../netapp/2022-11-01/backups/client.go | 26 - .../netapp/2022-11-01/backups/constants.go | 136 ---- .../2022-11-01/backups/id_accountbackup.go | 134 ---- .../backups/id_accountbackup_test.go | 327 ---------- .../netapp/2022-11-01/backups/id_backup.go | 152 ----- .../2022-11-01/backups/id_backup_test.go | 417 ------------ .../2022-11-01/backups/id_netappaccount.go | 125 ---- .../backups/id_netappaccount_test.go | 282 --------- .../netapp/2022-11-01/backups/id_volume.go | 143 ----- .../2022-11-01/backups/id_volume_test.go | 372 ----------- .../backups/method_accountbackupsdelete.go | 71 --- .../backups/method_accountbackupsget.go | 51 -- .../backups/method_accountbackupslist.go | 52 -- .../2022-11-01/backups/method_create.go | 75 --- .../2022-11-01/backups/method_delete.go | 71 --- .../netapp/2022-11-01/backups/method_get.go | 51 -- .../2022-11-01/backups/method_getstatus.go | 52 -- .../netapp/2022-11-01/backups/method_list.go | 52 -- .../2022-11-01/backups/method_restorefiles.go | 74 --- .../2022-11-01/backups/method_update.go | 74 --- .../netapp/2022-11-01/backups/model_backup.go | 17 - .../2022-11-01/backups/model_backuppatch.go | 9 - .../backups/model_backupproperties.go | 34 - .../backups/model_backuprestorefiles.go | 10 - .../2022-11-01/backups/model_backupslist.go | 8 - .../2022-11-01/backups/model_backupstatus.go | 15 - .../netapp/2022-11-01/backups/version.go | 12 - .../netapp/2022-11-01/capacitypools/README.md | 99 --- .../netapp/2022-11-01/capacitypools/client.go | 26 - .../2022-11-01/capacitypools/constants.go | 139 ---- .../capacitypools/id_capacitypool.go | 134 ---- .../capacitypools/id_capacitypool_test.go | 327 ---------- .../capacitypools/id_netappaccount.go | 125 ---- .../capacitypools/id_netappaccount_test.go | 282 --------- .../method_poolscreateorupdate.go | 74 --- .../capacitypools/method_poolsdelete.go | 70 -- .../capacitypools/method_poolsget.go | 51 -- .../capacitypools/method_poolslist.go | 89 --- .../capacitypools/method_poolsupdate.go | 74 --- .../capacitypools/model_capacitypool.go | 19 - .../capacitypools/model_capacitypoolpatch.go | 13 - .../model_poolpatchproperties.go | 10 - .../capacitypools/model_poolproperties.go | 16 - .../2022-11-01/capacitypools/predicates.go | 37 -- .../2022-11-01/capacitypools/version.go | 12 - resource-manager/netapp/2022-11-01/client.go | 199 ------ .../netapp/2022-11-01/filelocks/README.md | 37 -- .../netapp/2022-11-01/filelocks/client.go | 26 - .../netapp/2022-11-01/filelocks/id_volume.go | 143 ----- .../2022-11-01/filelocks/id_volume_test.go | 372 ----------- .../filelocks/method_volumesbreakfilelocks.go | 74 --- .../filelocks/model_breakfilelocksrequest.go | 9 - .../netapp/2022-11-01/filelocks/version.go | 12 - .../groupidlistforldapuser/README.md | 37 -- .../groupidlistforldapuser/client.go | 26 - .../groupidlistforldapuser/id_volume.go | 143 ----- .../groupidlistforldapuser/id_volume_test.go | 372 ----------- ...od_volumeslistgetgroupidlistforldapuser.go | 74 --- .../model_getgroupidlistforldapuserrequest.go | 8 - ...model_getgroupidlistforldapuserresponse.go | 8 - .../groupidlistforldapuser/version.go | 12 - .../2022-11-01/netappaccounts/README.md | 128 ---- .../2022-11-01/netappaccounts/client.go | 26 - .../2022-11-01/netappaccounts/constants.go | 151 ----- .../netappaccounts/id_netappaccount.go | 125 ---- .../netappaccounts/id_netappaccount_test.go | 282 --------- .../method_accountscreateorupdate.go | 74 --- .../netappaccounts/method_accountsdelete.go | 70 -- .../netappaccounts/method_accountsget.go | 51 -- .../netappaccounts/method_accountslist.go | 90 --- .../method_accountslistbysubscription.go | 90 --- .../method_accountsrenewcredentials.go | 70 -- .../netappaccounts/method_accountsupdate.go | 74 --- .../netappaccounts/model_accountencryption.go | 10 - .../netappaccounts/model_accountproperties.go | 11 - .../netappaccounts/model_activedirectory.go | 30 - .../model_encryptionidentity.go | 9 - .../model_keyvaultproperties.go | 12 - .../model_ldapsearchscopeopt.go | 10 - .../netappaccounts/model_netappaccount.go | 21 - .../model_netappaccountpatch.go | 18 - .../2022-11-01/netappaccounts/predicates.go | 37 -- .../2022-11-01/netappaccounts/version.go | 12 - .../2022-11-01/netappresource/README.md | 131 ---- .../2022-11-01/netappresource/client.go | 26 - .../2022-11-01/netappresource/constants.go | 204 ------ .../2022-11-01/netappresource/id_location.go | 116 ---- .../netappresource/id_location_test.go | 237 ------- .../netappresource/id_quotalimit.go | 125 ---- .../netappresource/id_quotalimit_test.go | 282 --------- .../method_checkfilepathavailability.go | 56 -- .../method_checknameavailability.go | 56 -- .../method_checkquotaavailability.go | 56 -- .../netappresource/method_queryregioninfo.go | 52 -- .../netappresource/method_quotalimitsget.go | 51 -- .../netappresource/method_quotalimitslist.go | 52 -- .../model_checkavailabilityresponse.go | 10 - .../model_filepathavailabilityrequest.go | 9 - .../model_quotaavailabilityrequest.go | 10 - .../netappresource/model_regioninfo.go | 9 - ...gioninfoavailabilityzonemappingsinlined.go | 9 - .../model_resourcenameavailabilityrequest.go | 10 - .../model_subscriptionquotaitem.go | 16 - .../model_subscriptionquotaitemlist.go | 8 - .../model_subscriptionquotaitemproperties.go | 9 - .../2022-11-01/netappresource/version.go | 12 - .../netapp/2022-11-01/poolchange/README.md | 37 -- .../netapp/2022-11-01/poolchange/client.go | 26 - .../netapp/2022-11-01/poolchange/id_volume.go | 143 ----- .../2022-11-01/poolchange/id_volume_test.go | 372 ----------- .../poolchange/method_volumespoolchange.go | 74 --- .../poolchange/model_poolchangerequest.go | 8 - .../netapp/2022-11-01/poolchange/version.go | 12 - .../2022-11-01/resetcifspassword/client.go | 26 - .../2022-11-01/resetcifspassword/id_volume.go | 143 ----- .../resetcifspassword/id_volume_test.go | 372 ----------- .../method_volumesresetcifspassword.go | 70 -- .../2022-11-01/resetcifspassword/version.go | 12 - .../netapp/2022-11-01/restore/README.md | 36 -- .../netapp/2022-11-01/restore/client.go | 26 - .../netapp/2022-11-01/restore/constants.go | 95 --- .../netapp/2022-11-01/restore/id_volume.go | 143 ----- .../2022-11-01/restore/id_volume_test.go | 372 ----------- .../method_backupsgetvolumerestorestatus.go | 52 -- .../2022-11-01/restore/model_restorestatus.go | 13 - .../netapp/2022-11-01/restore/version.go | 12 - .../2022-11-01/snapshotpolicy/README.md | 102 --- .../2022-11-01/snapshotpolicy/client.go | 26 - .../snapshotpolicy/id_netappaccount.go | 125 ---- .../snapshotpolicy/id_netappaccount_test.go | 282 --------- .../snapshotpolicy/id_snapshotpolicy.go | 134 ---- .../snapshotpolicy/id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpoliciescreate.go | 56 -- .../method_snapshotpoliciesdelete.go | 71 --- .../method_snapshotpoliciesget.go | 51 -- .../method_snapshotpolicieslist.go | 52 -- .../method_snapshotpoliciesupdate.go | 74 --- .../snapshotpolicy/model_dailyschedule.go | 11 - .../snapshotpolicy/model_hourlyschedule.go | 10 - .../snapshotpolicy/model_monthlyschedule.go | 12 - .../model_snapshotpolicieslist.go | 8 - .../snapshotpolicy/model_snapshotpolicy.go | 19 - .../model_snapshotpolicypatch.go | 13 - .../model_snapshotpolicyproperties.go | 13 - .../snapshotpolicy/model_weeklyschedule.go | 12 - .../2022-11-01/snapshotpolicy/version.go | 12 - .../snapshotpolicylistvolumes/README.md | 36 -- .../snapshotpolicylistvolumes/client.go | 26 - .../snapshotpolicylistvolumes/constants.go | 558 ---------------- .../id_snapshotpolicy.go | 134 ---- .../id_snapshotpolicy_test.go | 327 ---------- .../method_snapshotpolicieslistvolumes.go | 52 -- .../model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../model_replicationobject.go | 12 - .../model_snapshotpolicyvolumelist.go | 8 - .../snapshotpolicylistvolumes/model_volume.go | 21 - .../model_volumebackupproperties.go | 10 - .../model_volumeproperties.go | 60 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../model_volumesnapshotproperties.go | 8 - .../snapshotpolicylistvolumes/version.go | 12 - .../netapp/2022-11-01/snapshots/README.md | 111 ---- .../netapp/2022-11-01/snapshots/client.go | 26 - .../2022-11-01/snapshots/id_snapshot.go | 152 ----- .../2022-11-01/snapshots/id_snapshot_test.go | 417 ------------ .../netapp/2022-11-01/snapshots/id_volume.go | 143 ----- .../2022-11-01/snapshots/id_volume_test.go | 372 ----------- .../2022-11-01/snapshots/method_create.go | 74 --- .../2022-11-01/snapshots/method_delete.go | 71 --- .../netapp/2022-11-01/snapshots/method_get.go | 51 -- .../2022-11-01/snapshots/method_list.go | 52 -- .../snapshots/method_restorefiles.go | 74 --- .../2022-11-01/snapshots/method_update.go | 74 --- .../2022-11-01/snapshots/model_snapshot.go | 17 - .../snapshots/model_snapshotproperties.go | 28 - .../snapshots/model_snapshotrestorefiles.go | 9 - .../snapshots/model_snapshotslist.go | 8 - .../netapp/2022-11-01/snapshots/version.go | 12 - .../netapp/2022-11-01/subvolumes/README.md | 111 ---- .../netapp/2022-11-01/subvolumes/client.go | 26 - .../2022-11-01/subvolumes/id_subvolume.go | 152 ----- .../subvolumes/id_subvolume_test.go | 417 ------------ .../netapp/2022-11-01/subvolumes/id_volume.go | 143 ----- .../2022-11-01/subvolumes/id_volume_test.go | 372 ----------- .../2022-11-01/subvolumes/method_create.go | 75 --- .../2022-11-01/subvolumes/method_delete.go | 71 --- .../2022-11-01/subvolumes/method_get.go | 51 -- .../subvolumes/method_getmetadata.go | 70 -- .../subvolumes/method_listbyvolume.go | 89 --- .../2022-11-01/subvolumes/method_update.go | 74 --- .../subvolumes/model_subvolumeinfo.go | 16 - .../subvolumes/model_subvolumemodel.go | 11 - .../model_subvolumemodelproperties.go | 71 --- .../subvolumes/model_subvolumepatchparams.go | 9 - .../subvolumes/model_subvolumepatchrequest.go | 8 - .../subvolumes/model_subvolumeproperties.go | 11 - .../2022-11-01/subvolumes/predicates.go | 27 - .../netapp/2022-11-01/subvolumes/version.go | 12 - .../netapp/2022-11-01/volumegroups/README.md | 81 --- .../netapp/2022-11-01/volumegroups/client.go | 26 - .../2022-11-01/volumegroups/constants.go | 596 ------------------ .../volumegroups/id_netappaccount.go | 125 ---- .../volumegroups/id_netappaccount_test.go | 282 --------- .../2022-11-01/volumegroups/id_volumegroup.go | 134 ---- .../volumegroups/id_volumegroup_test.go | 327 ---------- .../2022-11-01/volumegroups/method_create.go | 73 --- .../2022-11-01/volumegroups/method_delete.go | 71 --- .../2022-11-01/volumegroups/method_get.go | 51 -- .../method_listbynetappaccount.go | 52 -- .../volumegroups/model_exportpolicyrule.go | 22 - .../model_mounttargetproperties.go | 11 - .../model_placementkeyvaluepairs.go | 9 - .../volumegroups/model_replicationobject.go | 12 - .../model_volumebackupproperties.go | 10 - .../volumegroups/model_volumegroup.go | 12 - .../volumegroups/model_volumegroupdetails.go | 12 - .../volumegroups/model_volumegrouplist.go | 8 - .../model_volumegrouplistproperties.go | 9 - .../volumegroups/model_volumegroupmetadata.go | 13 - .../model_volumegroupproperties.go | 10 - .../model_volumegroupvolumeproperties.go | 12 - .../volumegroups/model_volumeproperties.go | 60 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../model_volumesnapshotproperties.go | 8 - .../netapp/2022-11-01/volumegroups/version.go | 12 - .../2022-11-01/volumequotarules/README.md | 98 --- .../2022-11-01/volumequotarules/client.go | 26 - .../2022-11-01/volumequotarules/constants.go | 113 ---- .../2022-11-01/volumequotarules/id_volume.go | 143 ----- .../volumequotarules/id_volume_test.go | 372 ----------- .../volumequotarules/id_volumequotarule.go | 152 ----- .../id_volumequotarule_test.go | 417 ------------ .../volumequotarules/method_create.go | 74 --- .../volumequotarules/method_delete.go | 71 --- .../2022-11-01/volumequotarules/method_get.go | 51 -- .../volumequotarules/method_listbyvolume.go | 52 -- .../volumequotarules/method_update.go | 74 --- .../volumequotarules/model_volumequotarule.go | 18 - .../model_volumequotarulepatch.go | 9 - .../model_volumequotaruleslist.go | 8 - .../model_volumequotarulesproperties.go | 11 - .../2022-11-01/volumequotarules/version.go | 12 - .../netapp/2022-11-01/volumes/README.md | 99 --- .../netapp/2022-11-01/volumes/client.go | 26 - .../netapp/2022-11-01/volumes/constants.go | 558 ---------------- .../2022-11-01/volumes/id_capacitypool.go | 134 ---- .../volumes/id_capacitypool_test.go | 327 ---------- .../netapp/2022-11-01/volumes/id_volume.go | 143 ----- .../2022-11-01/volumes/id_volume_test.go | 372 ----------- .../volumes/method_createorupdate.go | 75 --- .../2022-11-01/volumes/method_delete.go | 98 --- .../netapp/2022-11-01/volumes/method_get.go | 51 -- .../netapp/2022-11-01/volumes/method_list.go | 89 --- .../2022-11-01/volumes/method_update.go | 74 --- .../volumes/model_exportpolicyrule.go | 22 - .../volumes/model_mounttargetproperties.go | 11 - .../volumes/model_placementkeyvaluepairs.go | 9 - .../volumes/model_replicationobject.go | 12 - .../netapp/2022-11-01/volumes/model_volume.go | 21 - .../volumes/model_volumebackupproperties.go | 10 - .../2022-11-01/volumes/model_volumepatch.go | 13 - .../volumes/model_volumepatchproperties.go | 19 - ...del_volumepatchpropertiesdataprotection.go | 9 - ...model_volumepatchpropertiesexportpolicy.go | 8 - .../volumes/model_volumeproperties.go | 60 -- .../model_volumepropertiesdataprotection.go | 11 - .../model_volumepropertiesexportpolicy.go | 8 - .../model_volumerelocationproperties.go | 9 - .../volumes/model_volumesnapshotproperties.go | 8 - .../netapp/2022-11-01/volumes/predicates.go | 37 -- .../netapp/2022-11-01/volumes/version.go | 12 - .../2022-11-01/volumesrelocation/README.md | 61 -- .../2022-11-01/volumesrelocation/client.go | 26 - .../2022-11-01/volumesrelocation/id_volume.go | 143 ----- .../volumesrelocation/id_volume_test.go | 372 ----------- .../method_volumesfinalizerelocation.go | 70 -- .../method_volumesrelocate.go | 74 --- .../method_volumesrevertrelocation.go | 70 -- .../model_relocatevolumerequest.go | 8 - .../2022-11-01/volumesrelocation/version.go | 12 - .../2022-11-01/volumesreplication/README.md | 139 ---- .../2022-11-01/volumesreplication/client.go | 26 - .../volumesreplication/constants.go | 180 ------ .../volumesreplication/id_volume.go | 143 ----- .../volumesreplication/id_volume_test.go | 372 ----------- .../method_volumesauthorizereplication.go | 74 --- .../method_volumesbreakreplication.go | 74 --- .../method_volumesdeletereplication.go | 70 -- .../method_volumeslistreplications.go | 52 -- .../method_volumesreestablishreplication.go | 73 --- .../method_volumesreinitializereplication.go | 70 -- .../method_volumesreplicationstatus.go | 52 -- .../method_volumesresyncreplication.go | 70 -- .../model_authorizerequest.go | 8 - .../model_breakreplicationrequest.go | 8 - .../model_listreplications.go | 8 - .../model_reestablishreplicationrequest.go | 8 - .../volumesreplication/model_replication.go | 11 - .../model_replicationstatus.go | 12 - .../2022-11-01/volumesreplication/version.go | 12 - .../netapp/2022-11-01/volumesrevert/README.md | 37 -- .../netapp/2022-11-01/volumesrevert/client.go | 26 - .../2022-11-01/volumesrevert/id_volume.go | 143 ----- .../volumesrevert/id_volume_test.go | 372 ----------- .../volumesrevert/method_volumesrevert.go | 74 --- .../volumesrevert/model_volumerevert.go | 8 - .../2022-11-01/volumesrevert/version.go | 12 - 1328 files changed, 111786 deletions(-) delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/README.md delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/client.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy_test.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciescreate.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesget.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/method_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicypatch.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicyproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/model_volumebackups.go delete mode 100644 resource-manager/netapp/2022-05-01/backuppolicy/version.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/README.md delete mode 100644 resource-manager/netapp/2022-05-01/backups/client.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_accountbackup.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_accountbackup_test.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_backup.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_backup_test.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_accountbackupsdelete.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_accountbackupsget.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_accountbackupslist.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_create.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_delete.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_get.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_getstatus.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_list.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/method_update.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/model_backup.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/model_backuppatch.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/model_backupproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/model_backupslist.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/model_backupstatus.go delete mode 100644 resource-manager/netapp/2022-05-01/backups/version.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/README.md delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/client.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/method_poolscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/method_poolsdelete.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/method_poolsget.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/method_poolslist.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/method_poolsupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/model_capacitypool.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/model_capacitypoolpatch.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/model_poolpatchproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/model_poolproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/predicates.go delete mode 100644 resource-manager/netapp/2022-05-01/capacitypools/version.go delete mode 100644 resource-manager/netapp/2022-05-01/client.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/README.md delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/client.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountsdelete.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountsget.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountslist.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountslistbysubscription.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountsrenewcredentials.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/method_accountsupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_accountencryption.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_accountproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_activedirectory.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_encryptionidentity.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_keyvaultproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_ldapsearchscopeopt.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccountpatch.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/predicates.go delete mode 100644 resource-manager/netapp/2022-05-01/netappaccounts/version.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/README.md delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/client.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/id_location.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/id_location_test.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/id_quotalimit_test.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/method_checkfilepathavailability.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/method_checknameavailability.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/method_checkquotaavailability.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/method_queryregioninfo.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/method_quotalimitsget.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/method_quotalimitslist.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_checkavailabilityresponse.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_filepathavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_quotaavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_regioninfo.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_resourcenameavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitem.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemlist.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/netappresource/version.go delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/README.md delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/client.go delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/method_volumespoolchange.go delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/model_poolchangerequest.go delete mode 100644 resource-manager/netapp/2022-05-01/poolchange/version.go delete mode 100644 resource-manager/netapp/2022-05-01/resetcifspassword/client.go delete mode 100644 resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/resetcifspassword/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/resetcifspassword/method_volumesresetcifspassword.go delete mode 100644 resource-manager/netapp/2022-05-01/resetcifspassword/version.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/README.md delete mode 100644 resource-manager/netapp/2022-05-01/restore/client.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/method_backupsgetvolumerestorestatus.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/model_restorestatus.go delete mode 100644 resource-manager/netapp/2022-05-01/restore/version.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/README.md delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/client.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciescreate.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesget.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_dailyschedule.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_hourlyschedule.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_monthlyschedule.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicypatch.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicyproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/model_weeklyschedule.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicy/version.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/README.md delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/version.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/README.md delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/client.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/id_snapshot_test.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/method_create.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/method_delete.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/method_get.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/method_list.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/method_restorefiles.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/method_update.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/model_snapshot.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/model_snapshotproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/model_snapshotrestorefiles.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/model_snapshotslist.go delete mode 100644 resource-manager/netapp/2022-05-01/snapshots/version.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/README.md delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/client.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/id_subvolume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/method_create.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/method_get.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/method_getmetadata.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/method_update.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeinfo.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodel.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodelproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchparams.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchrequest.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/predicates.go delete mode 100644 resource-manager/netapp/2022-05-01/subvolumes/version.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/README.md delete mode 100644 resource-manager/netapp/2022-05-01/vaults/client.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/method_list.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/model_vault.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/model_vaultlist.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/model_vaultproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/vaults/version.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/README.md delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/client.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/method_create.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/method_delete.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/method_get.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/method_listbynetappaccount.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegroup.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupdetails.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplist.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplistproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupmetadata.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumegroups/version.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/README.md delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/client.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/method_create.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/method_delete.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/method_get.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/method_update.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulepatch.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotaruleslist.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulesproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumequotarules/version.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/README.md delete mode 100644 resource-manager/netapp/2022-05-01/volumes/client.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/method_createorupdate.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/method_get.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/method_list.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/method_update.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumepatch.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumepatchproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/predicates.go delete mode 100644 resource-manager/netapp/2022-05-01/volumes/version.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/README.md delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/client.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesfinalizerelocation.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrelocate.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrevertrelocation.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/model_relocatevolumerequest.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrelocation/version.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/README.md delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/client.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/constants.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesauthorizereplication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesbreakreplication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesdeletereplication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumeslistreplications.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreestablishreplication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreinitializereplication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreplicationstatus.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/method_volumesresyncreplication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/model_authorizerequest.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/model_breakreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/model_listreplications.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/model_reestablishreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/model_replication.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/model_replicationstatus.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesreplication/version.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/README.md delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/client.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/method_volumesrevert.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/model_volumerevert.go delete mode 100644 resource-manager/netapp/2022-05-01/volumesrevert/version.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/README.md delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/client.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy_test.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciescreate.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesget.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/method_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicypatch.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicyproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/model_volumebackups.go delete mode 100644 resource-manager/netapp/2022-09-01/backuppolicy/version.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/README.md delete mode 100644 resource-manager/netapp/2022-09-01/backups/client.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_accountbackup.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_accountbackup_test.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_backup.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_backup_test.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_accountbackupsdelete.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_accountbackupsget.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_accountbackupslist.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_create.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_delete.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_get.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_getstatus.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_list.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_restorefiles.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/method_update.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/model_backup.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/model_backuppatch.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/model_backupproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/model_backuprestorefiles.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/model_backupslist.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/model_backupstatus.go delete mode 100644 resource-manager/netapp/2022-09-01/backups/version.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/README.md delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/client.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/method_poolscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/method_poolsdelete.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/method_poolsget.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/method_poolslist.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/method_poolsupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/model_capacitypool.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/model_capacitypoolpatch.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/model_poolpatchproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/model_poolproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/predicates.go delete mode 100644 resource-manager/netapp/2022-09-01/capacitypools/version.go delete mode 100644 resource-manager/netapp/2022-09-01/client.go delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/README.md delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/client.go delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/method_volumesbreakfilelocks.go delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/model_breakfilelocksrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/filelocks/version.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/README.md delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/client.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountsdelete.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountsget.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountslist.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountslistbysubscription.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountsrenewcredentials.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/method_accountsupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_accountencryption.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_accountproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_activedirectory.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_encryptionidentity.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_keyvaultproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_ldapsearchscopeopt.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccountpatch.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/predicates.go delete mode 100644 resource-manager/netapp/2022-09-01/netappaccounts/version.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/README.md delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/client.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/id_location.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/id_location_test.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/id_quotalimit_test.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/method_checkfilepathavailability.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/method_checknameavailability.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/method_checkquotaavailability.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/method_queryregioninfo.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/method_quotalimitsget.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/method_quotalimitslist.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_checkavailabilityresponse.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_filepathavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_quotaavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_regioninfo.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_resourcenameavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitem.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemlist.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/netappresource/version.go delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/README.md delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/client.go delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/method_volumespoolchange.go delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/model_poolchangerequest.go delete mode 100644 resource-manager/netapp/2022-09-01/poolchange/version.go delete mode 100644 resource-manager/netapp/2022-09-01/resetcifspassword/client.go delete mode 100644 resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/resetcifspassword/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/resetcifspassword/method_volumesresetcifspassword.go delete mode 100644 resource-manager/netapp/2022-09-01/resetcifspassword/version.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/README.md delete mode 100644 resource-manager/netapp/2022-09-01/restore/client.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/method_backupsgetvolumerestorestatus.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/model_restorestatus.go delete mode 100644 resource-manager/netapp/2022-09-01/restore/version.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/README.md delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/client.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciescreate.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesget.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_dailyschedule.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_hourlyschedule.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_monthlyschedule.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicypatch.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicyproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/model_weeklyschedule.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicy/version.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/README.md delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/version.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/README.md delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/client.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/id_snapshot_test.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/method_create.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/method_delete.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/method_get.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/method_list.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/method_restorefiles.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/method_update.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/model_snapshot.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/model_snapshotproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/model_snapshotrestorefiles.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/model_snapshotslist.go delete mode 100644 resource-manager/netapp/2022-09-01/snapshots/version.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/README.md delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/client.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/id_subvolume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/method_create.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/method_get.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/method_getmetadata.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/method_update.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeinfo.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodel.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodelproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchparams.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/predicates.go delete mode 100644 resource-manager/netapp/2022-09-01/subvolumes/version.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/README.md delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/client.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/method_create.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/method_delete.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/method_get.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/method_listbynetappaccount.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegroup.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupdetails.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplist.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplistproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupmetadata.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumegroups/version.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/README.md delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/client.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/method_create.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/method_delete.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/method_get.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/method_update.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulepatch.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotaruleslist.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulesproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumequotarules/version.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/README.md delete mode 100644 resource-manager/netapp/2022-09-01/volumes/client.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/method_createorupdate.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/method_get.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/method_list.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/method_update.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumepatch.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumepatchproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/predicates.go delete mode 100644 resource-manager/netapp/2022-09-01/volumes/version.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/README.md delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/client.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesfinalizerelocation.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrelocate.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrevertrelocation.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/model_relocatevolumerequest.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrelocation/version.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/README.md delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/client.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/constants.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesauthorizereplication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesbreakreplication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesdeletereplication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumeslistreplications.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreestablishreplication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreinitializereplication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreplicationstatus.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/method_volumesresyncreplication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/model_authorizerequest.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/model_breakreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/model_listreplications.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/model_reestablishreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/model_replication.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/model_replicationstatus.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesreplication/version.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/README.md delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/client.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/method_volumesrevert.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/model_volumerevert.go delete mode 100644 resource-manager/netapp/2022-09-01/volumesrevert/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciescreate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesget.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicypatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicyproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/model_volumebackups.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backuppolicy/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_backup.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_backup_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_backupvault_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsdelete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsget.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupslistbynetappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_getlateststatus.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_listbyvault.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_underaccountmigratebackups.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_underbackupvaultrestorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_undervolumemigratebackups.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backup.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backuppatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backuppatchproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backuprestorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backupslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backupsmigrationrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/model_backupstatus.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backups/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/method_createorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/method_listbynetappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvault.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultpatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/backupvaults/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsdelete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsget.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypool.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypoolpatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolpatchproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/capacitypools/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/method_volumesbreakfilelocks.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/model_breakfilelocksrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/filelocks/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsdelete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsget.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslistbysubscription.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsrenewcredentials.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountencryption.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_activedirectory.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_encryptionidentity.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_keyvaultproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_ldapsearchscopeopt.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccountpatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappaccounts/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/id_location_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/method_checkfilepathavailability.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/method_checknameavailability.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/method_checkquotaavailability.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/method_queryregioninfo.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitsget.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_checkavailabilityresponse.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_filepathavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_quotaavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfo.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfoavailabilityzonemappingsinlined.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_resourcenameavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitem.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemlist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/netappresource/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/method_volumespoolchange.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/model_poolchangerequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/poolchange/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/resetcifspassword/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/resetcifspassword/method_volumesresetcifspassword.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/resetcifspassword/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/method_backupsgetvolumerestorestatus.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/model_restorestatus.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/restore/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciescreate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesget.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_dailyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_hourlyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_monthlyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicypatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicyproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_weeklyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicy/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/method_list.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/method_restorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshot.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotrestorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/snapshots/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/method_getmetadata.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeinfo.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodel.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodelproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchparams.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/subvolumes/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/method_listbynetappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroup.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupdetails.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplistproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupmetadata.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumegroups/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulepatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotaruleslist.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulesproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumequotarules/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/method_createorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/method_list.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatch.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumes/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesfinalizerelocation.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrelocate.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrevertrelocation.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/model_relocatevolumerequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrelocation/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/constants.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesauthorizereplication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesbreakreplication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesdeletereplication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumeslistreplications.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreestablishreplication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreinitializereplication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreplicationstatus.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesresyncreplication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/model_authorizerequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/model_breakreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/model_listreplications.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/model_reestablishreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replication.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replicationstatus.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesreplication/version.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/README.md delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/client.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/method_volumesrevert.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/model_volumerevert.go delete mode 100644 resource-manager/netapp/2022-11-01-preview/volumesrevert/version.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/README.md delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/client.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy_test.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciescreate.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesget.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/method_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicypatch.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicyproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/model_volumebackups.go delete mode 100644 resource-manager/netapp/2022-11-01/backuppolicy/version.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/README.md delete mode 100644 resource-manager/netapp/2022-11-01/backups/client.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_accountbackup.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_accountbackup_test.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_backup.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_backup_test.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_accountbackupsdelete.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_accountbackupsget.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_accountbackupslist.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_getstatus.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_list.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_restorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/model_backup.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/model_backuppatch.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/model_backupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/model_backuprestorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/model_backupslist.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/model_backupstatus.go delete mode 100644 resource-manager/netapp/2022-11-01/backups/version.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/README.md delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/client.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/method_poolscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/method_poolsdelete.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/method_poolsget.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/method_poolslist.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/method_poolsupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/model_capacitypool.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/model_capacitypoolpatch.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/model_poolpatchproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/model_poolproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01/capacitypools/version.go delete mode 100644 resource-manager/netapp/2022-11-01/client.go delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/README.md delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/client.go delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/method_volumesbreakfilelocks.go delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/model_breakfilelocksrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/filelocks/version.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/README.md delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go delete mode 100644 resource-manager/netapp/2022-11-01/groupidlistforldapuser/version.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/README.md delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/client.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountscreateorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountsdelete.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountsget.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountslist.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountslistbysubscription.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountsrenewcredentials.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/method_accountsupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_accountencryption.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_accountproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_activedirectory.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_encryptionidentity.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_keyvaultproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_ldapsearchscopeopt.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccountpatch.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01/netappaccounts/version.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/README.md delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/client.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/id_location.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/id_location_test.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/id_quotalimit_test.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/method_checkfilepathavailability.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/method_checknameavailability.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/method_checkquotaavailability.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/method_queryregioninfo.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/method_quotalimitsget.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/method_quotalimitslist.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_checkavailabilityresponse.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_filepathavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_quotaavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_regioninfo.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_resourcenameavailabilityrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitem.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemlist.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/netappresource/version.go delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/README.md delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/client.go delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/method_volumespoolchange.go delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/model_poolchangerequest.go delete mode 100644 resource-manager/netapp/2022-11-01/poolchange/version.go delete mode 100644 resource-manager/netapp/2022-11-01/resetcifspassword/client.go delete mode 100644 resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/resetcifspassword/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/resetcifspassword/method_volumesresetcifspassword.go delete mode 100644 resource-manager/netapp/2022-11-01/resetcifspassword/version.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/README.md delete mode 100644 resource-manager/netapp/2022-11-01/restore/client.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/method_backupsgetvolumerestorestatus.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/model_restorestatus.go delete mode 100644 resource-manager/netapp/2022-11-01/restore/version.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/README.md delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/client.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciescreate.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesdelete.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesget.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_dailyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_hourlyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_monthlyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicieslist.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicypatch.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicyproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/model_weeklyschedule.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicy/version.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/README.md delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/version.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/README.md delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/client.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/id_snapshot_test.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/method_list.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/method_restorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/model_snapshot.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/model_snapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/model_snapshotrestorefiles.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/model_snapshotslist.go delete mode 100644 resource-manager/netapp/2022-11-01/snapshots/version.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/README.md delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/client.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/id_subvolume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/method_getmetadata.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeinfo.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodel.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodelproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchparams.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01/subvolumes/version.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/README.md delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/client.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/method_listbynetappaccount.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegroup.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupdetails.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplist.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplistproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupmetadata.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupvolumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumegroups/version.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/README.md delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/client.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/method_create.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/method_listbyvolume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarule.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulepatch.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotaruleslist.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulesproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumequotarules/version.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/README.md delete mode 100644 resource-manager/netapp/2022-11-01/volumes/client.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/id_capacitypool_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/method_createorupdate.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/method_delete.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/method_get.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/method_list.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/method_update.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_exportpolicyrule.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_mounttargetproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_placementkeyvaluepairs.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_replicationobject.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumebackupproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumepatch.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumepatchproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumeproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesdataprotection.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesexportpolicy.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumerelocationproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/model_volumesnapshotproperties.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/predicates.go delete mode 100644 resource-manager/netapp/2022-11-01/volumes/version.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/README.md delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/client.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesfinalizerelocation.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrelocate.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrevertrelocation.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/model_relocatevolumerequest.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrelocation/version.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/README.md delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/client.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/constants.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesauthorizereplication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesbreakreplication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesdeletereplication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumeslistreplications.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreestablishreplication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreinitializereplication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreplicationstatus.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/method_volumesresyncreplication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/model_authorizerequest.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/model_breakreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/model_listreplications.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/model_reestablishreplicationrequest.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/model_replication.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/model_replicationstatus.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesreplication/version.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/README.md delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/client.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/id_volume_test.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/method_volumesrevert.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/model_volumerevert.go delete mode 100644 resource-manager/netapp/2022-11-01/volumesrevert/version.go diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/README.md b/resource-manager/netapp/2022-05-01/backuppolicy/README.md deleted file mode 100644 index 1546cd408a1..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/backuppolicy` Documentation - -The `backuppolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue") - -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", "netAppAccountValue", "backupPolicyValue") - -payload := backuppolicy.BackupPolicyPatch{ - // ... -} - - -if err := client.BackupPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/client.go b/resource-manager/netapp/2022-05-01/backuppolicy/client.go deleted file mode 100644 index 1db45e634e5..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backuppolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) - } - - return &BackupPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go deleted file mode 100644 index f16f0b462b8..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), - resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy_test.go b/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy_test.go deleted file mode 100644 index 577058e02d3..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/id_backuppolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupPolicyId{} - -func TestNewBackupPolicyID(t *testing.T) { - id := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupPolicyName != "backupPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupPolicyName'", id.BackupPolicyName, "backupPolicyValue") - } -} - -func TestFormatBackupPolicyID(t *testing.T) { - actual := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestParseBackupPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupPolicyName: "bAcKuPpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestSegmentsForBackupPolicyId(t *testing.T) { - segments := BackupPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go deleted file mode 100644 index 6b11cb40365..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount_test.go deleted file mode 100644 index 2d0f311d8d1..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciescreate.go b/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciescreate.go deleted file mode 100644 index f0b9cef4c28..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciescreate.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesdelete.go b/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesdelete.go deleted file mode 100644 index 482cdc1780e..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesget.go b/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesget.go deleted file mode 100644 index 95b4f6f56a8..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppolicieslist.go b/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppolicieslist.go deleted file mode 100644 index 2730e8afc34..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesupdate.go b/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesupdate.go deleted file mode 100644 index 8e5456d63ac..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/method_backuppoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicieslist.go b/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicieslist.go deleted file mode 100644 index 3db3d131a60..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicy.go b/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicy.go deleted file mode 100644 index 747ab65be24..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -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/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicypatch.go b/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicypatch.go deleted file mode 100644 index bf7eecb1358..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -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/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicyproperties.go b/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicyproperties.go deleted file mode 100644 index d5694f4797d..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/model_backuppolicyproperties.go +++ /dev/null @@ -1,15 +0,0 @@ -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/resource-manager/netapp/2022-05-01/backuppolicy/model_volumebackups.go b/resource-manager/netapp/2022-05-01/backuppolicy/model_volumebackups.go deleted file mode 100644 index c01a5c25fd5..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/model_volumebackups.go +++ /dev/null @@ -1,10 +0,0 @@ -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"` -} diff --git a/resource-manager/netapp/2022-05-01/backuppolicy/version.go b/resource-manager/netapp/2022-05-01/backuppolicy/version.go deleted file mode 100644 index 97be0ff52b1..00000000000 --- a/resource-manager/netapp/2022-05-01/backuppolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backuppolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backuppolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/backups/README.md b/resource-manager/netapp/2022-05-01/backups/README.md deleted file mode 100644 index 4044bc35281..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/README.md +++ /dev/null @@ -1,158 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/backups` Documentation - -The `backups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/backups" -``` - - -### Client Initialization - -```go -client := backups.NewBackupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupsClient.AccountBackupsDelete` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -if err := client.AccountBackupsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsGet` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -read, err := client.AccountBackupsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsList` - -```go -ctx := context.TODO() -id := backups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountBackupsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.Create` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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.GetStatus` - -```go -ctx := context.TODO() -id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.GetStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.List` - -```go -ctx := context.TODO() -id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.Update` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -payload := backups.BackupPatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/backups/client.go b/resource-manager/netapp/2022-05-01/backups/client.go deleted file mode 100644 index a0f81d2a6ab..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) - } - - return &BackupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/backups/constants.go b/resource-manager/netapp/2022-05-01/backups/constants.go deleted file mode 100644 index e2ac45e345b..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/constants.go +++ /dev/null @@ -1,136 +0,0 @@ -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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go b/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go deleted file mode 100644 index b4091d27265..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_accountbackup.go +++ /dev/null @@ -1,134 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -// AccountBackupId is a struct representing the Resource ID for a Account Backup -type AccountBackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - AccountBackupName string -} - -// NewAccountBackupID returns a new AccountBackupId struct -func NewAccountBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, accountBackupName string) AccountBackupId { - return AccountBackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - AccountBackupName: accountBackupName, - } -} - -// ParseAccountBackupID parses 'input' into a AccountBackupId -func ParseAccountBackupID(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseAccountBackupIDInsensitively parses 'input' case-insensitively into a AccountBackupId -// note: this method should only be used for API response data and not user input -func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *AccountBackupId) 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.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) - } - - return nil -} - -// ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID -func ValidateAccountBackupID(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 := ParseAccountBackupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account Backup ID -func (id AccountBackupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/accountBackups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.AccountBackupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account Backup ID -func (id AccountBackupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticAccountBackups", "accountBackups", "accountBackups"), - resourceids.UserSpecifiedSegment("accountBackupName", "accountBackupValue"), - } -} - -// String returns a human-readable description of this Account Backup ID -func (id AccountBackupId) 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("Account Backup Name: %q", id.AccountBackupName), - } - return fmt.Sprintf("Account Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/backups/id_accountbackup_test.go b/resource-manager/netapp/2022-05-01/backups/id_accountbackup_test.go deleted file mode 100644 index 5371bde3e0a..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_accountbackup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -func TestNewAccountBackupID(t *testing.T) { - id := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.AccountBackupName != "accountBackupValue" { - t.Fatalf("Expected %q but got %q for Segment 'AccountBackupName'", id.AccountBackupName, "accountBackupValue") - } -} - -func TestFormatAccountBackupID(t *testing.T) { - actual := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseAccountBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestParseAccountBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - AccountBackupName: "aCcOuNtBaCkUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestSegmentsForAccountBackupId(t *testing.T) { - segments := AccountBackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("AccountBackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/backups/id_backup.go b/resource-manager/netapp/2022-05-01/backups/id_backup.go deleted file mode 100644 index 9c95bd9350f..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_backup.go +++ /dev/null @@ -1,152 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -// BackupId is a struct representing the Resource ID for a Backup -type BackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - BackupName string -} - -// NewBackupID returns a new BackupId struct -func NewBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, backupName string) BackupId { - return BackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - 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.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) - } - - 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/capacityPools/%s/volumes/%s/backups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticBackups", "backups", "backups"), - resourceids.UserSpecifiedSegment("backupName", "backupValue"), - } -} - -// 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("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Backup Name: %q", id.BackupName), - } - return fmt.Sprintf("Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/backups/id_backup_test.go b/resource-manager/netapp/2022-05-01/backups/id_backup_test.go deleted file mode 100644 index e6ca856e47e..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_backup_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -func TestNewBackupID(t *testing.T) { - id := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.BackupName != "backupValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupName'", id.BackupName, "backupValue") - } -} - -func TestFormatBackupID(t *testing.T) { - actual := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestParseBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs/bAcKuPvAlUe", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - BackupName: "bAcKuPvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs/bAcKuPvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestSegmentsForBackupId(t *testing.T) { - segments := BackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go b/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go deleted file mode 100644 index ced6c2088e0..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/backups/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/backups/id_netappaccount_test.go deleted file mode 100644 index bc4a37eeffd..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/backups/id_volume.go b/resource-manager/netapp/2022-05-01/backups/id_volume.go deleted file mode 100644 index 247b20b073e..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/backups/id_volume_test.go b/resource-manager/netapp/2022-05-01/backups/id_volume_test.go deleted file mode 100644 index d8f88fb84a4..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_accountbackupsdelete.go b/resource-manager/netapp/2022-05-01/backups/method_accountbackupsdelete.go deleted file mode 100644 index a55df55cf2e..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_accountbackupsdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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 AccountBackupsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountBackupsDelete ... -func (c BackupsClient) AccountBackupsDelete(ctx context.Context, id AccountBackupId) (result AccountBackupsDeleteOperationResponse, 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 -} - -// AccountBackupsDeleteThenPoll performs AccountBackupsDelete then polls until it's completed -func (c BackupsClient) AccountBackupsDeleteThenPoll(ctx context.Context, id AccountBackupId) error { - result, err := c.AccountBackupsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountBackupsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountBackupsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_accountbackupsget.go b/resource-manager/netapp/2022-05-01/backups/method_accountbackupsget.go deleted file mode 100644 index 1f242db5125..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_accountbackupsget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 AccountBackupsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *Backup -} - -// AccountBackupsGet ... -func (c BackupsClient) AccountBackupsGet(ctx context.Context, id AccountBackupId) (result AccountBackupsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_accountbackupslist.go b/resource-manager/netapp/2022-05-01/backups/method_accountbackupslist.go deleted file mode 100644 index 702e9d3951d..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_accountbackupslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 AccountBackupsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -// AccountBackupsList ... -func (c BackupsClient) AccountBackupsList(ctx context.Context, id NetAppAccountId) (result AccountBackupsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/accountBackups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_create.go b/resource-manager/netapp/2022-05-01/backups/method_create.go deleted file mode 100644 index 0e97dd6521a..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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.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 -} - -// 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/resource-manager/netapp/2022-05-01/backups/method_delete.go b/resource-manager/netapp/2022-05-01/backups/method_delete.go deleted file mode 100644 index 3472a05fa69..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -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, - 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 -} - -// 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/resource-manager/netapp/2022-05-01/backups/method_get.go b/resource-manager/netapp/2022-05-01/backups/method_get.go deleted file mode 100644 index 4ea8ec97737..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_getstatus.go b/resource-manager/netapp/2022-05-01/backups/method_getstatus.go deleted file mode 100644 index 0fed6c10cee..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_getstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -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 GetStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupStatus -} - -// GetStatus ... -func (c BackupsClient) GetStatus(ctx context.Context, id VolumeId) (result GetStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/backupStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_list.go b/resource-manager/netapp/2022-05-01/backups/method_list.go deleted file mode 100644 index f88403c6c9f..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -// List ... -func (c BackupsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - 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.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/backups/method_update.go b/resource-manager/netapp/2022-05-01/backups/method_update.go deleted file mode 100644 index 38c6398f381..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-05-01/backups/model_backup.go b/resource-manager/netapp/2022-05-01/backups/model_backup.go deleted file mode 100644 index c99372a2a3f..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/model_backup.go +++ /dev/null @@ -1,12 +0,0 @@ -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 Backup struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties BackupProperties `json:"properties"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/backups/model_backuppatch.go b/resource-manager/netapp/2022-05-01/backups/model_backuppatch.go deleted file mode 100644 index 5354276c3d2..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/model_backuppatch.go +++ /dev/null @@ -1,9 +0,0 @@ -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 *BackupProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/backups/model_backupproperties.go b/resource-manager/netapp/2022-05-01/backups/model_backupproperties.go deleted file mode 100644 index 800c6da1e29..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/model_backupproperties.go +++ /dev/null @@ -1,34 +0,0 @@ -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"` - 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"` - UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` - VolumeName *string `json:"volumeName,omitempty"` -} - -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/resource-manager/netapp/2022-05-01/backups/model_backupslist.go b/resource-manager/netapp/2022-05-01/backups/model_backupslist.go deleted file mode 100644 index d2e3929dbc7..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/model_backupslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 BackupsList struct { - Value *[]Backup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/backups/model_backupstatus.go b/resource-manager/netapp/2022-05-01/backups/model_backupstatus.go deleted file mode 100644 index 28d092897d7..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/model_backupstatus.go +++ /dev/null @@ -1,15 +0,0 @@ -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"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/backups/version.go b/resource-manager/netapp/2022-05-01/backups/version.go deleted file mode 100644 index 50902c8bc14..00000000000 --- a/resource-manager/netapp/2022-05-01/backups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/README.md b/resource-manager/netapp/2022-05-01/capacitypools/README.md deleted file mode 100644 index b0c976f00d9..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools` Documentation - -The `capacitypools` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/capacitypools" -``` - - -### Client Initialization - -```go -client := capacitypools.NewCapacityPoolsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `CapacityPoolsClient.PoolsCreateOrUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPool{ - // ... -} - - -if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsDelete` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsGet` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -read, err := client.PoolsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsList` - -```go -ctx := context.TODO() -id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -// alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination -items, err := client.PoolsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPoolPatch{ - // ... -} - - -if err := client.PoolsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/capacitypools/client.go b/resource-manager/netapp/2022-05-01/capacitypools/client.go deleted file mode 100644 index 3de33a3dc5b..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package capacitypools - -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 CapacityPoolsClient struct { - Client *resourcemanager.Client -} - -func NewCapacityPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityPoolsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "capacitypools", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) - } - - return &CapacityPoolsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/constants.go b/resource-manager/netapp/2022-05-01/capacitypools/constants.go deleted file mode 100644 index 802074e5dc1..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/constants.go +++ /dev/null @@ -1,139 +0,0 @@ -package capacitypools - -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 EncryptionType string - -const ( - EncryptionTypeDouble EncryptionType = "Double" - EncryptionTypeSingle EncryptionType = "Single" -) - -func PossibleValuesForEncryptionType() []string { - return []string{ - string(EncryptionTypeDouble), - string(EncryptionTypeSingle), - } -} - -func (s *EncryptionType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionType(input string) (*EncryptionType, error) { - vals := map[string]EncryptionType{ - "double": EncryptionTypeDouble, - "single": EncryptionTypeSingle, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionType(input) - return &out, nil -} - -type QosType string - -const ( - QosTypeAuto QosType = "Auto" - QosTypeManual QosType = "Manual" -) - -func PossibleValuesForQosType() []string { - return []string{ - string(QosTypeAuto), - string(QosTypeManual), - } -} - -func (s *QosType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseQosType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseQosType(input string) (*QosType, error) { - vals := map[string]QosType{ - "auto": QosTypeAuto, - "manual": QosTypeManual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QosType(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go deleted file mode 100644 index 69954702fd9..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool_test.go b/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool_test.go deleted file mode 100644 index a7eaff1ee66..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go deleted file mode 100644 index f424e58a9e8..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount_test.go deleted file mode 100644 index 13bb52f3713..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/method_poolscreateorupdate.go b/resource-manager/netapp/2022-05-01/capacitypools/method_poolscreateorupdate.go deleted file mode 100644 index d25b060fccf..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/method_poolscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsCreateOrUpdate ... -func (c CapacityPoolsClient) PoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (result PoolsCreateOrUpdateOperationResponse, 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 -} - -// PoolsCreateOrUpdateThenPoll performs PoolsCreateOrUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsCreateOrUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPool) error { - result, err := c.PoolsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/method_poolsdelete.go b/resource-manager/netapp/2022-05-01/capacitypools/method_poolsdelete.go deleted file mode 100644 index 36c9e0e6bcf..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/method_poolsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package capacitypools - -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 PoolsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsDelete ... -func (c CapacityPoolsClient) PoolsDelete(ctx context.Context, id CapacityPoolId) (result PoolsDeleteOperationResponse, 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 -} - -// PoolsDeleteThenPoll performs PoolsDelete then polls until it's completed -func (c CapacityPoolsClient) PoolsDeleteThenPoll(ctx context.Context, id CapacityPoolId) error { - result, err := c.PoolsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PoolsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/method_poolsget.go b/resource-manager/netapp/2022-05-01/capacitypools/method_poolsget.go deleted file mode 100644 index 26acc6641bb..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/method_poolsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package capacitypools - -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 PoolsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CapacityPool -} - -// PoolsGet ... -func (c CapacityPoolsClient) PoolsGet(ctx context.Context, id CapacityPoolId) (result PoolsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/method_poolslist.go b/resource-manager/netapp/2022-05-01/capacitypools/method_poolslist.go deleted file mode 100644 index 9b29e63dbdb..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/method_poolslist.go +++ /dev/null @@ -1,89 +0,0 @@ -package capacitypools - -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 PoolsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]CapacityPool -} - -type PoolsListCompleteResult struct { - Items []CapacityPool -} - -// PoolsList ... -func (c CapacityPoolsClient) PoolsList(ctx context.Context, id NetAppAccountId) (result PoolsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/capacityPools", 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 *[]CapacityPool `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// PoolsListComplete retrieves all the results into a single object -func (c CapacityPoolsClient) PoolsListComplete(ctx context.Context, id NetAppAccountId) (PoolsListCompleteResult, error) { - return c.PoolsListCompleteMatchingPredicate(ctx, id, CapacityPoolOperationPredicate{}) -} - -// PoolsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c CapacityPoolsClient) PoolsListCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate CapacityPoolOperationPredicate) (result PoolsListCompleteResult, err error) { - items := make([]CapacityPool, 0) - - resp, err := c.PoolsList(ctx, id) - if err != nil { - 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 = PoolsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/method_poolsupdate.go b/resource-manager/netapp/2022-05-01/capacitypools/method_poolsupdate.go deleted file mode 100644 index 7396db6d249..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/method_poolsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsUpdate ... -func (c CapacityPoolsClient) PoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (result PoolsUpdateOperationResponse, 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 -} - -// PoolsUpdateThenPoll performs PoolsUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) error { - result, err := c.PoolsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/model_capacitypool.go b/resource-manager/netapp/2022-05-01/capacitypools/model_capacitypool.go deleted file mode 100644 index f5d6f1ea86d..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/model_capacitypool.go +++ /dev/null @@ -1,19 +0,0 @@ -package capacitypools - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPool struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties PoolProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/model_capacitypoolpatch.go b/resource-manager/netapp/2022-05-01/capacitypools/model_capacitypoolpatch.go deleted file mode 100644 index 46abcde6b33..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/model_capacitypoolpatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PoolPatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/model_poolpatchproperties.go b/resource-manager/netapp/2022-05-01/capacitypools/model_poolpatchproperties.go deleted file mode 100644 index c971dd8637c..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/model_poolpatchproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolPatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/model_poolproperties.go b/resource-manager/netapp/2022-05-01/capacitypools/model_poolproperties.go deleted file mode 100644 index a1fee733fb4..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/model_poolproperties.go +++ /dev/null @@ -1,16 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - EncryptionType *EncryptionType `json:"encryptionType,omitempty"` - PoolId *string `json:"poolId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - ServiceLevel ServiceLevel `json:"serviceLevel"` - Size int64 `json:"size"` - TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` - UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/predicates.go b/resource-manager/netapp/2022-05-01/capacitypools/predicates.go deleted file mode 100644 index 386a7986d42..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p CapacityPoolOperationPredicate) Matches(input CapacityPool) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-05-01/capacitypools/version.go b/resource-manager/netapp/2022-05-01/capacitypools/version.go deleted file mode 100644 index f29d61d60ef..00000000000 --- a/resource-manager/netapp/2022-05-01/capacitypools/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package capacitypools - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/capacitypools/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/client.go b/resource-manager/netapp/2022-05-01/client.go deleted file mode 100644 index 0912a1622d7..00000000000 --- a/resource-manager/netapp/2022-05-01/client.go +++ /dev/null @@ -1,190 +0,0 @@ -package v2022_05_01 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/backuppolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/backups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/capacitypools" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappresource" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/poolchange" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/resetcifspassword" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/restore" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/subvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/vaults" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesrelocation" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesrevert" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" -) - -type Client struct { - BackupPolicy *backuppolicy.BackupPolicyClient - Backups *backups.BackupsClient - CapacityPools *capacitypools.CapacityPoolsClient - NetAppAccounts *netappaccounts.NetAppAccountsClient - NetAppResource *netappresource.NetAppResourceClient - PoolChange *poolchange.PoolChangeClient - ResetCifsPassword *resetcifspassword.ResetCifsPasswordClient - Restore *restore.RestoreClient - SnapshotPolicy *snapshotpolicy.SnapshotPolicyClient - SnapshotPolicyListVolumes *snapshotpolicylistvolumes.SnapshotPolicyListVolumesClient - Snapshots *snapshots.SnapshotsClient - SubVolumes *subvolumes.SubVolumesClient - Vaults *vaults.VaultsClient - VolumeGroups *volumegroups.VolumeGroupsClient - VolumeQuotaRules *volumequotarules.VolumeQuotaRulesClient - Volumes *volumes.VolumesClient - VolumesRelocation *volumesrelocation.VolumesRelocationClient - VolumesReplication *volumesreplication.VolumesReplicationClient - VolumesRevert *volumesrevert.VolumesRevertClient -} - -func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { - backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building BackupPolicy client: %+v", err) - } - configureFunc(backupPolicyClient.Client) - - backupsClient, err := backups.NewBackupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Backups client: %+v", err) - } - configureFunc(backupsClient.Client) - - capacityPoolsClient, err := capacitypools.NewCapacityPoolsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building CapacityPools client: %+v", err) - } - configureFunc(capacityPoolsClient.Client) - - netAppAccountsClient, err := netappaccounts.NewNetAppAccountsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppAccounts client: %+v", err) - } - configureFunc(netAppAccountsClient.Client) - - netAppResourceClient, err := netappresource.NewNetAppResourceClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppResource client: %+v", err) - } - configureFunc(netAppResourceClient.Client) - - poolChangeClient, err := poolchange.NewPoolChangeClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building PoolChange client: %+v", err) - } - configureFunc(poolChangeClient.Client) - - resetCifsPasswordClient, err := resetcifspassword.NewResetCifsPasswordClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building ResetCifsPassword client: %+v", err) - } - configureFunc(resetCifsPasswordClient.Client) - - restoreClient, err := restore.NewRestoreClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Restore client: %+v", err) - } - configureFunc(restoreClient.Client) - - snapshotPolicyClient, err := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicy client: %+v", err) - } - configureFunc(snapshotPolicyClient.Client) - - snapshotPolicyListVolumesClient, err := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicyListVolumes client: %+v", err) - } - configureFunc(snapshotPolicyListVolumesClient.Client) - - snapshotsClient, err := snapshots.NewSnapshotsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Snapshots client: %+v", err) - } - configureFunc(snapshotsClient.Client) - - subVolumesClient, err := subvolumes.NewSubVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SubVolumes client: %+v", err) - } - configureFunc(subVolumesClient.Client) - - vaultsClient, err := vaults.NewVaultsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Vaults client: %+v", err) - } - configureFunc(vaultsClient.Client) - - volumeGroupsClient, err := volumegroups.NewVolumeGroupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeGroups client: %+v", err) - } - configureFunc(volumeGroupsClient.Client) - - volumeQuotaRulesClient, err := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeQuotaRules client: %+v", err) - } - configureFunc(volumeQuotaRulesClient.Client) - - volumesClient, err := volumes.NewVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Volumes client: %+v", err) - } - configureFunc(volumesClient.Client) - - volumesRelocationClient, err := volumesrelocation.NewVolumesRelocationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRelocation client: %+v", err) - } - configureFunc(volumesRelocationClient.Client) - - volumesReplicationClient, err := volumesreplication.NewVolumesReplicationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesReplication client: %+v", err) - } - configureFunc(volumesReplicationClient.Client) - - volumesRevertClient, err := volumesrevert.NewVolumesRevertClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRevert client: %+v", err) - } - configureFunc(volumesRevertClient.Client) - - return &Client{ - BackupPolicy: backupPolicyClient, - Backups: backupsClient, - CapacityPools: capacityPoolsClient, - NetAppAccounts: netAppAccountsClient, - NetAppResource: netAppResourceClient, - PoolChange: poolChangeClient, - ResetCifsPassword: resetCifsPasswordClient, - Restore: restoreClient, - SnapshotPolicy: snapshotPolicyClient, - SnapshotPolicyListVolumes: snapshotPolicyListVolumesClient, - Snapshots: snapshotsClient, - SubVolumes: subVolumesClient, - Vaults: vaultsClient, - VolumeGroups: volumeGroupsClient, - VolumeQuotaRules: volumeQuotaRulesClient, - Volumes: volumesClient, - VolumesRelocation: volumesRelocationClient, - VolumesReplication: volumesReplicationClient, - VolumesRevert: volumesRevertClient, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/README.md b/resource-manager/netapp/2022-05-01/netappaccounts/README.md deleted file mode 100644 index 1849c21a15e..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/README.md +++ /dev/null @@ -1,128 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappaccounts` Documentation - -The `netappaccounts` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/netappaccounts" -``` - - -### Client Initialization - -```go -client := netappaccounts.NewNetAppAccountsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppAccountsClient.AccountsCreateOrUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccount{ - // ... -} - - -if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsDelete` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsGet` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsList` - -```go -ctx := context.TODO() -id := netappaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsListBySubscription` - -```go -ctx := context.TODO() -id := netappaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.AccountsListBySubscription(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListBySubscriptionComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsRenewCredentials` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsRenewCredentialsThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccountPatch{ - // ... -} - - -if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/client.go b/resource-manager/netapp/2022-05-01/netappaccounts/client.go deleted file mode 100644 index 172f1218e2c..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappaccounts - -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 NetAppAccountsClient struct { - Client *resourcemanager.Client -} - -func NewNetAppAccountsClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppAccountsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappaccounts", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) - } - - return &NetAppAccountsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/constants.go b/resource-manager/netapp/2022-05-01/netappaccounts/constants.go deleted file mode 100644 index f8d0489c2a0..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/constants.go +++ /dev/null @@ -1,151 +0,0 @@ -package netappaccounts - -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 ActiveDirectoryStatus string - -const ( - ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" - ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" - ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" - ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" - ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" -) - -func PossibleValuesForActiveDirectoryStatus() []string { - return []string{ - string(ActiveDirectoryStatusCreated), - string(ActiveDirectoryStatusDeleted), - string(ActiveDirectoryStatusError), - string(ActiveDirectoryStatusInUse), - string(ActiveDirectoryStatusUpdating), - } -} - -func (s *ActiveDirectoryStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseActiveDirectoryStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseActiveDirectoryStatus(input string) (*ActiveDirectoryStatus, error) { - vals := map[string]ActiveDirectoryStatus{ - "created": ActiveDirectoryStatusCreated, - "deleted": ActiveDirectoryStatusDeleted, - "error": ActiveDirectoryStatusError, - "inuse": ActiveDirectoryStatusInUse, - "updating": ActiveDirectoryStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ActiveDirectoryStatus(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" - KeySourceMicrosoftPointNetApp KeySource = "Microsoft.NetApp" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceMicrosoftPointKeyVault), - string(KeySourceMicrosoftPointNetApp), - } -} - -func (s *KeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, - "microsoft.netapp": KeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type KeyVaultStatus string - -const ( - KeyVaultStatusCreated KeyVaultStatus = "Created" - KeyVaultStatusDeleted KeyVaultStatus = "Deleted" - KeyVaultStatusError KeyVaultStatus = "Error" - KeyVaultStatusInUse KeyVaultStatus = "InUse" - KeyVaultStatusUpdating KeyVaultStatus = "Updating" -) - -func PossibleValuesForKeyVaultStatus() []string { - return []string{ - string(KeyVaultStatusCreated), - string(KeyVaultStatusDeleted), - string(KeyVaultStatusError), - string(KeyVaultStatusInUse), - string(KeyVaultStatusUpdating), - } -} - -func (s *KeyVaultStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeyVaultStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeyVaultStatus(input string) (*KeyVaultStatus, error) { - vals := map[string]KeyVaultStatus{ - "created": KeyVaultStatusCreated, - "deleted": KeyVaultStatusDeleted, - "error": KeyVaultStatusError, - "inuse": KeyVaultStatusInUse, - "updating": KeyVaultStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyVaultStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go deleted file mode 100644 index 07a8ef7a579..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappaccounts - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount_test.go deleted file mode 100644 index 0e58b3e4d97..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappaccounts - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountscreateorupdate.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountscreateorupdate.go deleted file mode 100644 index 7d7c0d2ca88..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsCreateOrUpdate ... -func (c NetAppAccountsClient) AccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (result AccountsCreateOrUpdateOperationResponse, 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 -} - -// AccountsCreateOrUpdateThenPoll performs AccountsCreateOrUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsCreateOrUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccount) error { - result, err := c.AccountsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsdelete.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsdelete.go deleted file mode 100644 index ae46b7b061d..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsDelete ... -func (c NetAppAccountsClient) AccountsDelete(ctx context.Context, id NetAppAccountId) (result AccountsDeleteOperationResponse, 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 -} - -// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed -func (c NetAppAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsget.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsget.go deleted file mode 100644 index 4cc63a91e9f..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappaccounts - -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 AccountsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *NetAppAccount -} - -// AccountsGet ... -func (c NetAppAccountsClient) AccountsGet(ctx context.Context, id NetAppAccountId) (result AccountsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountslist.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountslist.go deleted file mode 100644 index 3f16fbcc847..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountslist.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListCompleteResult struct { - Items []NetAppAccount -} - -// AccountsList ... -func (c NetAppAccountsClient) AccountsList(ctx context.Context, id commonids.ResourceGroupId) (result AccountsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListCompleteResult, error) { - return c.AccountsListCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetAppAccountOperationPredicate) (result AccountsListCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsList(ctx, id) - if err != nil { - 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 = AccountsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountslistbysubscription.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountslistbysubscription.go deleted file mode 100644 index 0b66b7c904a..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountslistbysubscription.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListBySubscriptionCompleteResult struct { - Items []NetAppAccount -} - -// AccountsListBySubscription ... -func (c NetAppAccountsClient) AccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result AccountsListBySubscriptionOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListBySubscriptionComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListBySubscriptionCompleteResult, error) { - return c.AccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetAppAccountOperationPredicate) (result AccountsListBySubscriptionCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsListBySubscription(ctx, id) - if err != nil { - 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 = AccountsListBySubscriptionCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsrenewcredentials.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsrenewcredentials.go deleted file mode 100644 index 4d7aca0b151..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsrenewcredentials.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsRenewCredentialsOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsRenewCredentials ... -func (c NetAppAccountsClient) AccountsRenewCredentials(ctx context.Context, id NetAppAccountId) (result AccountsRenewCredentialsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/renewCredentials", 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 -} - -// AccountsRenewCredentialsThenPoll performs AccountsRenewCredentials then polls until it's completed -func (c NetAppAccountsClient) AccountsRenewCredentialsThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsRenewCredentials(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsRenewCredentials: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsRenewCredentials: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsupdate.go b/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsupdate.go deleted file mode 100644 index 14d063ae23d..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/method_accountsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsUpdate ... -func (c NetAppAccountsClient) AccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (result AccountsUpdateOperationResponse, 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 -} - -// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) error { - result, err := c.AccountsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_accountencryption.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_accountencryption.go deleted file mode 100644 index 93f1a662f77..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_accountencryption.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryption struct { - Identity *EncryptionIdentity `json:"identity,omitempty"` - KeySource *KeySource `json:"keySource,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_accountproperties.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_accountproperties.go deleted file mode 100644 index 18428908f56..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_accountproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountProperties struct { - ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` - DisableShowmount *bool `json:"disableShowmount,omitempty"` - Encryption *AccountEncryption `json:"encryption,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_activedirectory.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_activedirectory.go deleted file mode 100644 index da90d13da0a..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_activedirectory.go +++ /dev/null @@ -1,29 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ActiveDirectory struct { - ActiveDirectoryId *string `json:"activeDirectoryId,omitempty"` - AdName *string `json:"adName,omitempty"` - Administrators *[]string `json:"administrators,omitempty"` - AesEncryption *bool `json:"aesEncryption,omitempty"` - AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` - BackupOperators *[]string `json:"backupOperators,omitempty"` - Dns *string `json:"dns,omitempty"` - Domain *string `json:"domain,omitempty"` - EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` - KdcIP *string `json:"kdcIP,omitempty"` - LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` - LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` - LdapSigning *bool `json:"ldapSigning,omitempty"` - OrganizationalUnit *string `json:"organizationalUnit,omitempty"` - Password *string `json:"password,omitempty"` - SecurityOperators *[]string `json:"securityOperators,omitempty"` - ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` - Site *string `json:"site,omitempty"` - SmbServerName *string `json:"smbServerName,omitempty"` - Status *ActiveDirectoryStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - Username *string `json:"username,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_encryptionidentity.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_encryptionidentity.go deleted file mode 100644 index 50cf4dbf679..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_encryptionidentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncryptionIdentity struct { - PrincipalId *string `json:"principalId,omitempty"` - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_keyvaultproperties.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_keyvaultproperties.go deleted file mode 100644 index ac5d8c6afa4..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_keyvaultproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KeyVaultProperties struct { - KeyName string `json:"keyName"` - KeyVaultId *string `json:"keyVaultId,omitempty"` - KeyVaultResourceId string `json:"keyVaultResourceId"` - KeyVaultUri string `json:"keyVaultUri"` - Status *KeyVaultStatus `json:"status,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_ldapsearchscopeopt.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_ldapsearchscopeopt.go deleted file mode 100644 index c476b0f0875..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_ldapsearchscopeopt.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LdapSearchScopeOpt struct { - GroupDN *string `json:"groupDN,omitempty"` - GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` - UserDN *string `json:"userDN,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccount.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccount.go deleted file mode 100644 index ae38663e126..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccount.go +++ /dev/null @@ -1,21 +0,0 @@ -package netappaccounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccount struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccountpatch.go b/resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccountpatch.go deleted file mode 100644 index d3c6c1efcc2..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/model_netappaccountpatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/predicates.go b/resource-manager/netapp/2022-05-01/netappaccounts/predicates.go deleted file mode 100644 index ad2c0a55483..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p NetAppAccountOperationPredicate) Matches(input NetAppAccount) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-05-01/netappaccounts/version.go b/resource-manager/netapp/2022-05-01/netappaccounts/version.go deleted file mode 100644 index 968fe11ac73..00000000000 --- a/resource-manager/netapp/2022-05-01/netappaccounts/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappaccounts/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/README.md b/resource-manager/netapp/2022-05-01/netappresource/README.md deleted file mode 100644 index ac9908b6f2b..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/README.md +++ /dev/null @@ -1,131 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/netappresource` Documentation - -The `netappresource` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/netappresource" -``` - - -### Client Initialization - -```go -client := netappresource.NewNetAppResourceClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppResourceClient.CheckFilePathAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.FilePathAvailabilityRequest{ - // ... -} - - -read, err := client.CheckFilePathAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckNameAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.ResourceNameAvailabilityRequest{ - // ... -} - - -read, err := client.CheckNameAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckQuotaAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.QuotaAvailabilityRequest{ - // ... -} - - -read, err := client.CheckQuotaAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QueryRegionInfo` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QueryRegionInfo(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsGet` - -```go -ctx := context.TODO() -id := netappresource.NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - -read, err := client.QuotaLimitsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsList` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QuotaLimitsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-05-01/netappresource/client.go b/resource-manager/netapp/2022-05-01/netappresource/client.go deleted file mode 100644 index e02988617d8..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappresource - -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 NetAppResourceClient struct { - Client *resourcemanager.Client -} - -func NewNetAppResourceClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppResourceClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappresource", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) - } - - return &NetAppResourceClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/constants.go b/resource-manager/netapp/2022-05-01/netappresource/constants.go deleted file mode 100644 index a4510b72228..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/constants.go +++ /dev/null @@ -1,192 +0,0 @@ -package netappresource - -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 CheckNameResourceTypes string - -const ( - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckNameResourceTypes() []string { - return []string{ - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckNameResourceTypes(input string) (*CheckNameResourceTypes, error) { - vals := map[string]CheckNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckNameResourceTypes(input) - return &out, nil -} - -type CheckQuotaNameResourceTypes string - -const ( - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckQuotaNameResourceTypes() []string { - return []string{ - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckQuotaNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckQuotaNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckQuotaNameResourceTypes(input string) (*CheckQuotaNameResourceTypes, error) { - vals := map[string]CheckQuotaNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckQuotaNameResourceTypes(input) - return &out, nil -} - -type InAvailabilityReasonType string - -const ( - InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" - InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" -) - -func PossibleValuesForInAvailabilityReasonType() []string { - return []string{ - string(InAvailabilityReasonTypeAlreadyExists), - string(InAvailabilityReasonTypeInvalid), - } -} - -func (s *InAvailabilityReasonType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseInAvailabilityReasonType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseInAvailabilityReasonType(input string) (*InAvailabilityReasonType, error) { - vals := map[string]InAvailabilityReasonType{ - "alreadyexists": InAvailabilityReasonTypeAlreadyExists, - "invalid": InAvailabilityReasonTypeInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InAvailabilityReasonType(input) - return &out, nil -} - -type RegionStorageToNetworkProximity string - -const ( - RegionStorageToNetworkProximityDefault RegionStorageToNetworkProximity = "Default" - RegionStorageToNetworkProximityTOne RegionStorageToNetworkProximity = "T1" - RegionStorageToNetworkProximityTOneAndTTwo RegionStorageToNetworkProximity = "T1AndT2" - RegionStorageToNetworkProximityTTwo RegionStorageToNetworkProximity = "T2" -) - -func PossibleValuesForRegionStorageToNetworkProximity() []string { - return []string{ - string(RegionStorageToNetworkProximityDefault), - string(RegionStorageToNetworkProximityTOne), - string(RegionStorageToNetworkProximityTOneAndTTwo), - string(RegionStorageToNetworkProximityTTwo), - } -} - -func (s *RegionStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRegionStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRegionStorageToNetworkProximity(input string) (*RegionStorageToNetworkProximity, error) { - vals := map[string]RegionStorageToNetworkProximity{ - "default": RegionStorageToNetworkProximityDefault, - "t1": RegionStorageToNetworkProximityTOne, - "t1andt2": RegionStorageToNetworkProximityTOneAndTTwo, - "t2": RegionStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RegionStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/id_location.go b/resource-manager/netapp/2022-05-01/netappresource/id_location.go deleted file mode 100644 index 7c120e2a191..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/id_location.go +++ /dev/null @@ -1,116 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - LocationName string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, locationName string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - return nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(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 := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/id_location_test.go b/resource-manager/netapp/2022-05-01/netappresource/id_location_test.go deleted file mode 100644 index 37beb10bbc3..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/id_location_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -func TestNewLocationID(t *testing.T) { - id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } -} - -func TestFormatLocationID(t *testing.T) { - actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseLocationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestParseLocationIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestSegmentsForLocationId(t *testing.T) { - segments := LocationId{}.Segments() - if len(segments) == 0 { - t.Fatalf("LocationId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go deleted file mode 100644 index aa29f073d5d..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -// QuotaLimitId is a struct representing the Resource ID for a Quota Limit -type QuotaLimitId struct { - SubscriptionId string - LocationName string - QuotaLimitName string -} - -// NewQuotaLimitID returns a new QuotaLimitId struct -func NewQuotaLimitID(subscriptionId string, locationName string, quotaLimitName string) QuotaLimitId { - return QuotaLimitId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - QuotaLimitName: quotaLimitName, - } -} - -// ParseQuotaLimitID parses 'input' into a QuotaLimitId -func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseQuotaLimitIDInsensitively parses 'input' case-insensitively into a QuotaLimitId -// note: this method should only be used for API response data and not user input -func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) - } - - return nil -} - -// ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID -func ValidateQuotaLimitID(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 := ParseQuotaLimitID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Quota Limit ID -func (id QuotaLimitId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s/quotaLimits/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.QuotaLimitName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Quota Limit ID -func (id QuotaLimitId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - resourceids.StaticSegment("staticQuotaLimits", "quotaLimits", "quotaLimits"), - resourceids.UserSpecifiedSegment("quotaLimitName", "quotaLimitValue"), - } -} - -// String returns a human-readable description of this Quota Limit ID -func (id QuotaLimitId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - fmt.Sprintf("Quota Limit Name: %q", id.QuotaLimitName), - } - return fmt.Sprintf("Quota Limit (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit_test.go b/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit_test.go deleted file mode 100644 index ca3050d8d70..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/id_quotalimit_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -func TestNewQuotaLimitID(t *testing.T) { - id := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } - - if id.QuotaLimitName != "quotaLimitValue" { - t.Fatalf("Expected %q but got %q for Segment 'QuotaLimitName'", id.QuotaLimitName, "quotaLimitValue") - } -} - -func TestFormatQuotaLimitID(t *testing.T) { - actual := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseQuotaLimitID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestParseQuotaLimitIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - QuotaLimitName: "qUoTaLiMiTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestSegmentsForQuotaLimitId(t *testing.T) { - segments := QuotaLimitId{}.Segments() - if len(segments) == 0 { - t.Fatalf("QuotaLimitId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/method_checkfilepathavailability.go b/resource-manager/netapp/2022-05-01/netappresource/method_checkfilepathavailability.go deleted file mode 100644 index ccaafd95a81..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/method_checkfilepathavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckFilePathAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckFilePathAvailability ... -func (c NetAppResourceClient) CheckFilePathAvailability(ctx context.Context, id LocationId, input FilePathAvailabilityRequest) (result CheckFilePathAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkFilePathAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/method_checknameavailability.go b/resource-manager/netapp/2022-05-01/netappresource/method_checknameavailability.go deleted file mode 100644 index 277efaba606..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/method_checknameavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckNameAvailability ... -func (c NetAppResourceClient) CheckNameAvailability(ctx context.Context, id LocationId, input ResourceNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkNameAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/method_checkquotaavailability.go b/resource-manager/netapp/2022-05-01/netappresource/method_checkquotaavailability.go deleted file mode 100644 index e332f8c761b..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/method_checkquotaavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckQuotaAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckQuotaAvailability ... -func (c NetAppResourceClient) CheckQuotaAvailability(ctx context.Context, id LocationId, input QuotaAvailabilityRequest) (result CheckQuotaAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkQuotaAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/method_queryregioninfo.go b/resource-manager/netapp/2022-05-01/netappresource/method_queryregioninfo.go deleted file mode 100644 index bce1ced7640..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/method_queryregioninfo.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QueryRegionInfoOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RegionInfo -} - -// QueryRegionInfo ... -func (c NetAppResourceClient) QueryRegionInfo(ctx context.Context, id LocationId) (result QueryRegionInfoOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/regionInfo", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/method_quotalimitsget.go b/resource-manager/netapp/2022-05-01/netappresource/method_quotalimitsget.go deleted file mode 100644 index 2b566bfa762..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/method_quotalimitsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappresource - -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 QuotaLimitsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItem -} - -// QuotaLimitsGet ... -func (c NetAppResourceClient) QuotaLimitsGet(ctx context.Context, id QuotaLimitId) (result QuotaLimitsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/method_quotalimitslist.go b/resource-manager/netapp/2022-05-01/netappresource/method_quotalimitslist.go deleted file mode 100644 index e7dcec4cc4e..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/method_quotalimitslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QuotaLimitsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItemList -} - -// QuotaLimitsList ... -func (c NetAppResourceClient) QuotaLimitsList(ctx context.Context, id LocationId) (result QuotaLimitsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/quotaLimits", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_checkavailabilityresponse.go b/resource-manager/netapp/2022-05-01/netappresource/model_checkavailabilityresponse.go deleted file mode 100644 index 6423d9de076..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_checkavailabilityresponse.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckAvailabilityResponse struct { - IsAvailable *bool `json:"isAvailable,omitempty"` - Message *string `json:"message,omitempty"` - Reason *InAvailabilityReasonType `json:"reason,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_filepathavailabilityrequest.go b/resource-manager/netapp/2022-05-01/netappresource/model_filepathavailabilityrequest.go deleted file mode 100644 index 6407d29060b..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_filepathavailabilityrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilePathAvailabilityRequest struct { - Name string `json:"name"` - SubnetId string `json:"subnetId"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_quotaavailabilityrequest.go b/resource-manager/netapp/2022-05-01/netappresource/model_quotaavailabilityrequest.go deleted file mode 100644 index d8df9ac4cef..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_quotaavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type QuotaAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckQuotaNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_regioninfo.go b/resource-manager/netapp/2022-05-01/netappresource/model_regioninfo.go deleted file mode 100644 index 63c92a72c98..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_regioninfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfo struct { - AvailabilityZoneMappings *[]RegionInfoAvailabilityZoneMappingsInlined `json:"availabilityZoneMappings,omitempty"` - StorageToNetworkProximity *RegionStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go b/resource-manager/netapp/2022-05-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go deleted file mode 100644 index 36fce7489dc..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfoAvailabilityZoneMappingsInlined struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - IsAvailable *bool `json:"isAvailable,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_resourcenameavailabilityrequest.go b/resource-manager/netapp/2022-05-01/netappresource/model_resourcenameavailabilityrequest.go deleted file mode 100644 index 0bfbaf4c0e9..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_resourcenameavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ResourceNameAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitem.go b/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitem.go deleted file mode 100644 index 88a5cbd39c1..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitem.go +++ /dev/null @@ -1,16 +0,0 @@ -package netappresource - -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 SubscriptionQuotaItem struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubscriptionQuotaItemProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemlist.go b/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemlist.go deleted file mode 100644 index 800319869a1..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemlist.go +++ /dev/null @@ -1,8 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemList struct { - Value *[]SubscriptionQuotaItem `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemproperties.go b/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemproperties.go deleted file mode 100644 index 01cdd538c05..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/model_subscriptionquotaitemproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemProperties struct { - Current *int64 `json:"current,omitempty"` - Default *int64 `json:"default,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/netappresource/version.go b/resource-manager/netapp/2022-05-01/netappresource/version.go deleted file mode 100644 index effa33346a5..00000000000 --- a/resource-manager/netapp/2022-05-01/netappresource/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappresource - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappresource/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/poolchange/README.md b/resource-manager/netapp/2022-05-01/poolchange/README.md deleted file mode 100644 index 933082e8e46..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/poolchange` Documentation - -The `poolchange` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/poolchange" -``` - - -### Client Initialization - -```go -client := poolchange.NewPoolChangeClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `PoolChangeClient.VolumesPoolChange` - -```go -ctx := context.TODO() -id := poolchange.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := poolchange.PoolChangeRequest{ - // ... -} - - -if err := client.VolumesPoolChangeThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/poolchange/client.go b/resource-manager/netapp/2022-05-01/poolchange/client.go deleted file mode 100644 index 270c25028c2..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package poolchange - -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 PoolChangeClient struct { - Client *resourcemanager.Client -} - -func NewPoolChangeClientWithBaseURI(sdkApi sdkEnv.Api) (*PoolChangeClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "poolchange", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) - } - - return &PoolChangeClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/poolchange/id_volume.go b/resource-manager/netapp/2022-05-01/poolchange/id_volume.go deleted file mode 100644 index 60065ac10ae..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package poolchange - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/poolchange/id_volume_test.go b/resource-manager/netapp/2022-05-01/poolchange/id_volume_test.go deleted file mode 100644 index 496e8bbcaad..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package poolchange - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/poolchange/method_volumespoolchange.go b/resource-manager/netapp/2022-05-01/poolchange/method_volumespoolchange.go deleted file mode 100644 index 7a0ca0e6450..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/method_volumespoolchange.go +++ /dev/null @@ -1,74 +0,0 @@ -package poolchange - -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 VolumesPoolChangeOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesPoolChange ... -func (c PoolChangeClient) VolumesPoolChange(ctx context.Context, id VolumeId, input PoolChangeRequest) (result VolumesPoolChangeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/poolChange", 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 -} - -// VolumesPoolChangeThenPoll performs VolumesPoolChange then polls until it's completed -func (c PoolChangeClient) VolumesPoolChangeThenPoll(ctx context.Context, id VolumeId, input PoolChangeRequest) error { - result, err := c.VolumesPoolChange(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesPoolChange: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesPoolChange: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/poolchange/model_poolchangerequest.go b/resource-manager/netapp/2022-05-01/poolchange/model_poolchangerequest.go deleted file mode 100644 index 19402a5b699..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/model_poolchangerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package poolchange - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolChangeRequest struct { - NewPoolResourceId string `json:"newPoolResourceId"` -} diff --git a/resource-manager/netapp/2022-05-01/poolchange/version.go b/resource-manager/netapp/2022-05-01/poolchange/version.go deleted file mode 100644 index 4d57be04367..00000000000 --- a/resource-manager/netapp/2022-05-01/poolchange/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package poolchange - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/poolchange/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/resetcifspassword/client.go b/resource-manager/netapp/2022-05-01/resetcifspassword/client.go deleted file mode 100644 index 2d17ccc3976..00000000000 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package resetcifspassword - -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 ResetCifsPasswordClient struct { - Client *resourcemanager.Client -} - -func NewResetCifsPasswordClientWithBaseURI(sdkApi sdkEnv.Api) (*ResetCifsPasswordClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "resetcifspassword", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) - } - - return &ResetCifsPasswordClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go deleted file mode 100644 index 69421cfe5d9..00000000000 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package resetcifspassword - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume_test.go b/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume_test.go deleted file mode 100644 index 9b41608cce7..00000000000 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package resetcifspassword - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/resetcifspassword/method_volumesresetcifspassword.go b/resource-manager/netapp/2022-05-01/resetcifspassword/method_volumesresetcifspassword.go deleted file mode 100644 index ca6d379fdfc..00000000000 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/method_volumesresetcifspassword.go +++ /dev/null @@ -1,70 +0,0 @@ -package resetcifspassword - -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 VolumesResetCifsPasswordOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResetCifsPassword ... -func (c ResetCifsPasswordClient) VolumesResetCifsPassword(ctx context.Context, id VolumeId) (result VolumesResetCifsPasswordOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resetCifsPassword", 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 -} - -// VolumesResetCifsPasswordThenPoll performs VolumesResetCifsPassword then polls until it's completed -func (c ResetCifsPasswordClient) VolumesResetCifsPasswordThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResetCifsPassword(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResetCifsPassword: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResetCifsPassword: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/resetcifspassword/version.go b/resource-manager/netapp/2022-05-01/resetcifspassword/version.go deleted file mode 100644 index 25dcda0ee09..00000000000 --- a/resource-manager/netapp/2022-05-01/resetcifspassword/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package resetcifspassword - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/resetcifspassword/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/restore/README.md b/resource-manager/netapp/2022-05-01/restore/README.md deleted file mode 100644 index 7a9dee63ee9..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/restore` Documentation - -The `restore` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/restore" -``` - - -### Client Initialization - -```go -client := restore.NewRestoreClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `RestoreClient.BackupsGetVolumeRestoreStatus` - -```go -ctx := context.TODO() -id := restore.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.BackupsGetVolumeRestoreStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-05-01/restore/client.go b/resource-manager/netapp/2022-05-01/restore/client.go deleted file mode 100644 index 97fa355d7db..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package restore - -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 RestoreClient struct { - Client *resourcemanager.Client -} - -func NewRestoreClientWithBaseURI(sdkApi sdkEnv.Api) (*RestoreClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "restore", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) - } - - return &RestoreClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/restore/constants.go b/resource-manager/netapp/2022-05-01/restore/constants.go deleted file mode 100644 index 9eea259cd41..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/constants.go +++ /dev/null @@ -1,95 +0,0 @@ -package restore - -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 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/restore/id_volume.go b/resource-manager/netapp/2022-05-01/restore/id_volume.go deleted file mode 100644 index 46089747e17..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package restore - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/restore/id_volume_test.go b/resource-manager/netapp/2022-05-01/restore/id_volume_test.go deleted file mode 100644 index 2f07b6ef48e..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package restore - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/restore/method_backupsgetvolumerestorestatus.go b/resource-manager/netapp/2022-05-01/restore/method_backupsgetvolumerestorestatus.go deleted file mode 100644 index 47f85cfa0ce..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/method_backupsgetvolumerestorestatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package restore - -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 BackupsGetVolumeRestoreStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RestoreStatus -} - -// BackupsGetVolumeRestoreStatus ... -func (c RestoreClient) BackupsGetVolumeRestoreStatus(ctx context.Context, id VolumeId) (result BackupsGetVolumeRestoreStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/restoreStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/restore/model_restorestatus.go b/resource-manager/netapp/2022-05-01/restore/model_restorestatus.go deleted file mode 100644 index 546d31e9ce7..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/model_restorestatus.go +++ /dev/null @@ -1,13 +0,0 @@ -package restore - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/restore/version.go b/resource-manager/netapp/2022-05-01/restore/version.go deleted file mode 100644 index e1dc8e3898d..00000000000 --- a/resource-manager/netapp/2022-05-01/restore/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package restore - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/restore/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md b/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md deleted file mode 100644 index e456e9d22d3..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/README.md +++ /dev/null @@ -1,102 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicy` Documentation - -The `snapshotpolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/snapshotpolicy" -``` - - -### Client Initialization - -```go -client := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesCreate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicy{ - // ... -} - - -read, err := client.SnapshotPoliciesCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesDelete` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesGet` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesList` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.SnapshotPoliciesList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesUpdate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicyPatch{ - // ... -} - - -if err := client.SnapshotPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go deleted file mode 100644 index eebb8c7b8da..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicy - -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 SnapshotPolicyClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) - } - - return &SnapshotPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go deleted file mode 100644 index 162b7094379..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount_test.go deleted file mode 100644 index c181f6cd7cd..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go deleted file mode 100644 index 3daea71a654..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy_test.go deleted file mode 100644 index b3f070cc0f2..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciescreate.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciescreate.go deleted file mode 100644 index 8a1724f9e0d..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciescreate.go +++ /dev/null @@ -1,56 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesCreateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesCreate ... -func (c SnapshotPolicyClient) SnapshotPoliciesCreate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicy) (result SnapshotPoliciesCreateOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesdelete.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesdelete.go deleted file mode 100644 index 88822a15bf8..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesDelete ... -func (c SnapshotPolicyClient) SnapshotPoliciesDelete(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesDeleteOperationResponse, 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 -} - -// SnapshotPoliciesDeleteThenPoll performs SnapshotPoliciesDelete then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesDeleteThenPoll(ctx context.Context, id SnapshotPolicyId) error { - result, err := c.SnapshotPoliciesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesget.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesget.go deleted file mode 100644 index ebb812f1ffb..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesGet ... -func (c SnapshotPolicyClient) SnapshotPoliciesGet(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpolicieslist.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpolicieslist.go deleted file mode 100644 index bec4c8146b3..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPoliciesList -} - -// SnapshotPoliciesList ... -func (c SnapshotPolicyClient) SnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (result SnapshotPoliciesListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshotPolicies", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesupdate.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesupdate.go deleted file mode 100644 index 46bf5bd6f56..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/method_snapshotpoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesUpdate ... -func (c SnapshotPolicyClient) SnapshotPoliciesUpdate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) (result SnapshotPoliciesUpdateOperationResponse, 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 -} - -// SnapshotPoliciesUpdateThenPoll performs SnapshotPoliciesUpdate then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesUpdateThenPoll(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) error { - result, err := c.SnapshotPoliciesUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_dailyschedule.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_dailyschedule.go deleted file mode 100644 index bdafb72e6e0..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_dailyschedule.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DailySchedule struct { - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_hourlyschedule.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_hourlyschedule.go deleted file mode 100644 index a1e5d0fa028..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_hourlyschedule.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type HourlySchedule struct { - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_monthlyschedule.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_monthlyschedule.go deleted file mode 100644 index 02cbcad6a59..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_monthlyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MonthlySchedule struct { - DaysOfMonth *string `json:"daysOfMonth,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicieslist.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicieslist.go deleted file mode 100644 index 910e2519adb..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPoliciesList struct { - Value *[]SnapshotPolicy `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicy.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicy.go deleted file mode 100644 index 310cfaaf1bb..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -package snapshotpolicy - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicy struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties SnapshotPolicyProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicypatch.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicypatch.go deleted file mode 100644 index 76df9be172b..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SnapshotPolicyProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicyproperties.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicyproperties.go deleted file mode 100644 index fb4fb0fcb05..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_snapshotpolicyproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyProperties struct { - DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` - MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_weeklyschedule.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/model_weeklyschedule.go deleted file mode 100644 index 128ece7ef5e..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/model_weeklyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type WeeklySchedule struct { - Day *string `json:"day,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicy/version.go b/resource-manager/netapp/2022-05-01/snapshotpolicy/version.go deleted file mode 100644 index c2169f8dcf7..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/README.md b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/README.md deleted file mode 100644 index e5f4cde4d20..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes` Documentation - -The `snapshotpolicylistvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/snapshotpolicylistvolumes" -``` - - -### Client Initialization - -```go -client := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyListVolumesClient.SnapshotPoliciesListVolumes` - -```go -ctx := context.TODO() -id := snapshotpolicylistvolumes.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesListVolumes(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go deleted file mode 100644 index 047d79a12c3..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPolicyListVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicylistvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) - } - - return &SnapshotPolicyListVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/constants.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/constants.go deleted file mode 100644 index c440366387d..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/constants.go +++ /dev/null @@ -1,514 +0,0 @@ -package snapshotpolicylistvolumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go deleted file mode 100644 index 37d159192cf..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go deleted file mode 100644 index b7b4ebfa73a..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go deleted file mode 100644 index 95000d4db93..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPoliciesListVolumesOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicyVolumeList -} - -// SnapshotPoliciesListVolumes ... -func (c SnapshotPolicyListVolumesClient) SnapshotPoliciesListVolumes(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesListVolumesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_exportpolicyrule.go deleted file mode 100644 index dd6bb7a20fc..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_mounttargetproperties.go deleted file mode 100644 index 49f9f6f131a..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 0d5756a7089..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_replicationobject.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_replicationobject.go deleted file mode 100644 index 97bf50ea504..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go deleted file mode 100644 index 2d14e9596fe..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyVolumeList struct { - Value *[]Volume `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volume.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volume.go deleted file mode 100644 index 36417f52891..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumebackupproperties.go deleted file mode 100644 index a84fb7c82cd..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumebackupproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` - VaultId *string `json:"vaultId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumeproperties.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumeproperties.go deleted file mode 100644 index cf37846f214..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumeproperties.go +++ /dev/null @@ -1,54 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index 542b576797f..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 1ad178d6e25..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go deleted file mode 100644 index e4915375144..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/version.go b/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/version.go deleted file mode 100644 index 08a7329f719..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshotpolicylistvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicylistvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/README.md b/resource-manager/netapp/2022-05-01/snapshots/README.md deleted file mode 100644 index 5104c1a1052..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/snapshots` Documentation - -The `snapshots` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/snapshots" -``` - - -### Client Initialization - -```go -client := snapshots.NewSnapshotsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotsClient.Create` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.Snapshot{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Delete` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Get` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.List` - -```go -ctx := context.TODO() -id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.RestoreFiles` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.SnapshotRestoreFiles{ - // ... -} - - -if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Update` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") -var payload interface{} - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/snapshots/client.go b/resource-manager/netapp/2022-05-01/snapshots/client.go deleted file mode 100644 index 620b7900eab..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshots - -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 SnapshotsClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) - } - - return &SnapshotsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go b/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go deleted file mode 100644 index 8a20d21ec27..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/id_snapshot.go +++ /dev/null @@ -1,152 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -// SnapshotId is a struct representing the Resource ID for a Snapshot -type SnapshotId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SnapshotName string -} - -// NewSnapshotID returns a new SnapshotId struct -func NewSnapshotID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, snapshotName string) SnapshotId { - return SnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SnapshotName: snapshotName, - } -} - -// ParseSnapshotID parses 'input' into a SnapshotId -func ParseSnapshotID(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotIDInsensitively parses 'input' case-insensitively into a SnapshotId -// note: this method should only be used for API response data and not user input -func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotId) 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) - } - - if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) - } - - return nil -} - -// ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID -func ValidateSnapshotID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSnapshotID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot ID -func (id SnapshotId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SnapshotName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot ID -func (id SnapshotId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), - resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), - } -} - -// String returns a human-readable description of this Snapshot ID -func (id SnapshotId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), - } - return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/id_snapshot_test.go b/resource-manager/netapp/2022-05-01/snapshots/id_snapshot_test.go deleted file mode 100644 index 4dd0b44f4a3..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/id_snapshot_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -func TestNewSnapshotID(t *testing.T) { - id := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SnapshotName != "snapshotValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotName'", id.SnapshotName, "snapshotValue") - } -} - -func TestFormatSnapshotID(t *testing.T) { - actual := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestParseSnapshotIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SnapshotName: "sNaPsHoTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestSegmentsForSnapshotId(t *testing.T) { - segments := SnapshotId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/id_volume.go b/resource-manager/netapp/2022-05-01/snapshots/id_volume.go deleted file mode 100644 index 06879ea6a3a..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/snapshots/id_volume_test.go b/resource-manager/netapp/2022-05-01/snapshots/id_volume_test.go deleted file mode 100644 index 6bcb01d8ea1..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/method_create.go b/resource-manager/netapp/2022-05-01/snapshots/method_create.go deleted file mode 100644 index 1c781284afe..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Create ... -func (c SnapshotsClient) Create(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusCreated, - }, - 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 SnapshotsClient) CreateThenPoll(ctx context.Context, id SnapshotId, input Snapshot) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/method_delete.go b/resource-manager/netapp/2022-05-01/snapshots/method_delete.go deleted file mode 100644 index ef16480f860..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SnapshotsClient) DeleteThenPoll(ctx context.Context, id SnapshotId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/method_get.go b/resource-manager/netapp/2022-05-01/snapshots/method_get.go deleted file mode 100644 index 4f024ded473..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/method_list.go b/resource-manager/netapp/2022-05-01/snapshots/method_list.go deleted file mode 100644 index f1079759c22..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotsList -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshots", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/method_restorefiles.go b/resource-manager/netapp/2022-05-01/snapshots/method_restorefiles.go deleted file mode 100644 index 685be44a5ff..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/method_restorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 RestoreFilesOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// RestoreFiles ... -func (c SnapshotsClient) RestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (result RestoreFilesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - 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 -} - -// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed -func (c SnapshotsClient) RestoreFilesThenPoll(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) error { - result, err := c.RestoreFiles(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RestoreFiles: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after RestoreFiles: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/method_update.go b/resource-manager/netapp/2022-05-01/snapshots/method_update.go deleted file mode 100644 index 656719e61bd..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Update ... -func (c SnapshotsClient) Update(ctx context.Context, id SnapshotId, input interface{}) (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 SnapshotsClient) UpdateThenPoll(ctx context.Context, id SnapshotId, input interface{}) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/model_snapshot.go b/resource-manager/netapp/2022-05-01/snapshots/model_snapshot.go deleted file mode 100644 index 996c7160dd1..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/model_snapshot.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Snapshot struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *SnapshotProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/model_snapshotproperties.go b/resource-manager/netapp/2022-05-01/snapshots/model_snapshotproperties.go deleted file mode 100644 index fe60537eaaa..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/model_snapshotproperties.go +++ /dev/null @@ -1,28 +0,0 @@ -package snapshots - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotProperties struct { - Created *string `json:"created,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` -} - -func (o *SnapshotProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *SnapshotProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/model_snapshotrestorefiles.go b/resource-manager/netapp/2022-05-01/snapshots/model_snapshotrestorefiles.go deleted file mode 100644 index de80d971dcf..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/model_snapshotrestorefiles.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotRestoreFiles struct { - DestinationPath *string `json:"destinationPath,omitempty"` - FilePaths []string `json:"filePaths"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/model_snapshotslist.go b/resource-manager/netapp/2022-05-01/snapshots/model_snapshotslist.go deleted file mode 100644 index bf283b0d2ac..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/model_snapshotslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotsList struct { - Value *[]Snapshot `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/snapshots/version.go b/resource-manager/netapp/2022-05-01/snapshots/version.go deleted file mode 100644 index 5a40a00ed72..00000000000 --- a/resource-manager/netapp/2022-05-01/snapshots/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshots - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshots/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/README.md b/resource-manager/netapp/2022-05-01/subvolumes/README.md deleted file mode 100644 index a35404c3c7c..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/subvolumes` Documentation - -The `subvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/subvolumes" -``` - - -### Client Initialization - -```go -client := subvolumes.NewSubVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SubVolumesClient.Create` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumeInfo{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Delete` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Get` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -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: `SubVolumesClient.GetMetadata` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.GetMetadataThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.ListByVolume` - -```go -ctx := context.TODO() -id := subvolumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -// alternatively `client.ListByVolume(ctx, id)` can be used to do batched pagination -items, err := client.ListByVolumeComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `SubVolumesClient.Update` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumePatchRequest{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/subvolumes/client.go b/resource-manager/netapp/2022-05-01/subvolumes/client.go deleted file mode 100644 index b675258d906..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package subvolumes - -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 SubVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSubVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SubVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "subvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) - } - - return &SubVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go deleted file mode 100644 index 0649b6aeac0..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume.go +++ /dev/null @@ -1,152 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -// SubVolumeId is a struct representing the Resource ID for a Sub Volume -type SubVolumeId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SubVolumeName string -} - -// NewSubVolumeID returns a new SubVolumeId struct -func NewSubVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, subVolumeName string) SubVolumeId { - return SubVolumeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SubVolumeName: subVolumeName, - } -} - -// ParseSubVolumeID parses 'input' into a SubVolumeId -func ParseSubVolumeID(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSubVolumeIDInsensitively parses 'input' case-insensitively into a SubVolumeId -// note: this method should only be used for API response data and not user input -func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SubVolumeId) 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) - } - - if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) - } - - return nil -} - -// ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID -func ValidateSubVolumeID(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 := ParseSubVolumeID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Sub Volume ID -func (id SubVolumeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/subVolumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SubVolumeName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Sub Volume ID -func (id SubVolumeId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSubVolumes", "subVolumes", "subVolumes"), - resourceids.UserSpecifiedSegment("subVolumeName", "subVolumeValue"), - } -} - -// String returns a human-readable description of this Sub Volume ID -func (id SubVolumeId) 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), - fmt.Sprintf("Sub Volume Name: %q", id.SubVolumeName), - } - return fmt.Sprintf("Sub Volume (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume_test.go b/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume_test.go deleted file mode 100644 index f76df7c9c16..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/id_subvolume_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -func TestNewSubVolumeID(t *testing.T) { - id := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SubVolumeName != "subVolumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'SubVolumeName'", id.SubVolumeName, "subVolumeValue") - } -} - -func TestFormatSubVolumeID(t *testing.T) { - actual := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestParseSubVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SubVolumeName: "sUbVoLuMeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestSegmentsForSubVolumeId(t *testing.T) { - segments := SubVolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubVolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go b/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go deleted file mode 100644 index 8bbeb6c9e23..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/subvolumes/id_volume_test.go b/resource-manager/netapp/2022-05-01/subvolumes/id_volume_test.go deleted file mode 100644 index 7d4f6c8d6f1..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/method_create.go b/resource-manager/netapp/2022-05-01/subvolumes/method_create.go deleted file mode 100644 index 65a0d34e8d4..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -package subvolumes - -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 -} - -// Create ... -func (c SubVolumesClient) Create(ctx context.Context, id SubVolumeId, input SubvolumeInfo) (result CreateOperationResponse, 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 -} - -// CreateThenPoll performs Create then polls until it's completed -func (c SubVolumesClient) CreateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumeInfo) 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/resource-manager/netapp/2022-05-01/subvolumes/method_delete.go b/resource-manager/netapp/2022-05-01/subvolumes/method_delete.go deleted file mode 100644 index 2f19ed22f0c..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubVolumesClient) Delete(ctx context.Context, id SubVolumeId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SubVolumesClient) DeleteThenPoll(ctx context.Context, id SubVolumeId) 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/resource-manager/netapp/2022-05-01/subvolumes/method_get.go b/resource-manager/netapp/2022-05-01/subvolumes/method_get.go deleted file mode 100644 index 063628c3271..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package subvolumes - -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 *SubvolumeInfo -} - -// Get ... -func (c SubVolumesClient) Get(ctx context.Context, id SubVolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/method_getmetadata.go b/resource-manager/netapp/2022-05-01/subvolumes/method_getmetadata.go deleted file mode 100644 index a38be9004ef..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/method_getmetadata.go +++ /dev/null @@ -1,70 +0,0 @@ -package subvolumes - -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 GetMetadataOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// GetMetadata ... -func (c SubVolumesClient) GetMetadata(ctx context.Context, id SubVolumeId) (result GetMetadataOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/getMetadata", 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 -} - -// GetMetadataThenPoll performs GetMetadata then polls until it's completed -func (c SubVolumesClient) GetMetadataThenPoll(ctx context.Context, id SubVolumeId) error { - result, err := c.GetMetadata(ctx, id) - if err != nil { - return fmt.Errorf("performing GetMetadata: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after GetMetadata: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/method_listbyvolume.go b/resource-manager/netapp/2022-05-01/subvolumes/method_listbyvolume.go deleted file mode 100644 index 50bba7a698f..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/method_listbyvolume.go +++ /dev/null @@ -1,89 +0,0 @@ -package subvolumes - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]SubvolumeInfo -} - -type ListByVolumeCompleteResult struct { - Items []SubvolumeInfo -} - -// ListByVolume ... -func (c SubVolumesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/subVolumes", 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 *[]SubvolumeInfo `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListByVolumeComplete retrieves all the results into a single object -func (c SubVolumesClient) ListByVolumeComplete(ctx context.Context, id VolumeId) (ListByVolumeCompleteResult, error) { - return c.ListByVolumeCompleteMatchingPredicate(ctx, id, SubvolumeInfoOperationPredicate{}) -} - -// ListByVolumeCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c SubVolumesClient) ListByVolumeCompleteMatchingPredicate(ctx context.Context, id VolumeId, predicate SubvolumeInfoOperationPredicate) (result ListByVolumeCompleteResult, err error) { - items := make([]SubvolumeInfo, 0) - - resp, err := c.ListByVolume(ctx, id) - if err != nil { - 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 = ListByVolumeCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/method_update.go b/resource-manager/netapp/2022-05-01/subvolumes/method_update.go deleted file mode 100644 index 919d2776e7f..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package subvolumes - -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 -} - -// Update ... -func (c SubVolumesClient) Update(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) (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 SubVolumesClient) UpdateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) 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/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeinfo.go b/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeinfo.go deleted file mode 100644 index 3adbcfc6002..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeinfo.go +++ /dev/null @@ -1,16 +0,0 @@ -package subvolumes - -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 SubvolumeInfo struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodel.go b/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodel.go deleted file mode 100644 index d15828e2987..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodel.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeModelProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodelproperties.go b/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodelproperties.go deleted file mode 100644 index 26911c386fc..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumemodelproperties.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubvolumeModelProperties struct { - AccessedTimeStamp *string `json:"accessedTimeStamp,omitempty"` - BytesUsed *int64 `json:"bytesUsed,omitempty"` - ChangedTimeStamp *string `json:"changedTimeStamp,omitempty"` - CreationTimeStamp *string `json:"creationTimeStamp,omitempty"` - ModifiedTimeStamp *string `json:"modifiedTimeStamp,omitempty"` - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - Permissions *string `json:"permissions,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} - -func (o *SubvolumeModelProperties) GetAccessedTimeStampAsTime() (*time.Time, error) { - if o.AccessedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.AccessedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetAccessedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.AccessedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetChangedTimeStampAsTime() (*time.Time, error) { - if o.ChangedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ChangedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetChangedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ChangedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetCreationTimeStampAsTime() (*time.Time, error) { - if o.CreationTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreationTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetCreationTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreationTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetModifiedTimeStampAsTime() (*time.Time, error) { - if o.ModifiedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ModifiedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetModifiedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ModifiedTimeStamp = &formatted -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchparams.go b/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchparams.go deleted file mode 100644 index 02ea94ff0ac..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchparams.go +++ /dev/null @@ -1,9 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchParams struct { - Path *string `json:"path,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchrequest.go b/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchrequest.go deleted file mode 100644 index 0394a55073a..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumepatchrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchRequest struct { - Properties *SubvolumePatchParams `json:"properties,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeproperties.go b/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeproperties.go deleted file mode 100644 index 899e995183a..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/model_subvolumeproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeProperties struct { - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/subvolumes/predicates.go b/resource-manager/netapp/2022-05-01/subvolumes/predicates.go deleted file mode 100644 index af649a6bd08..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeInfoOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p SubvolumeInfoOperationPredicate) Matches(input SubvolumeInfo) 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/resource-manager/netapp/2022-05-01/subvolumes/version.go b/resource-manager/netapp/2022-05-01/subvolumes/version.go deleted file mode 100644 index d0d3940be0e..00000000000 --- a/resource-manager/netapp/2022-05-01/subvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package subvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/subvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/vaults/README.md b/resource-manager/netapp/2022-05-01/vaults/README.md deleted file mode 100644 index f101ce2e447..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/vaults` Documentation - -The `vaults` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/vaults" -``` - - -### Client Initialization - -```go -client := vaults.NewVaultsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VaultsClient.List` - -```go -ctx := context.TODO() -id := vaults.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-05-01/vaults/client.go b/resource-manager/netapp/2022-05-01/vaults/client.go deleted file mode 100644 index 1ddc5db936e..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package vaults - -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 VaultsClient struct { - Client *resourcemanager.Client -} - -func NewVaultsClientWithBaseURI(sdkApi sdkEnv.Api) (*VaultsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vaults", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VaultsClient: %+v", err) - } - - return &VaultsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go b/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go deleted file mode 100644 index b71b0d0cf87..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package vaults - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/vaults/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/vaults/id_netappaccount_test.go deleted file mode 100644 index 6893d442334..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package vaults - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/vaults/method_list.go b/resource-manager/netapp/2022-05-01/vaults/method_list.go deleted file mode 100644 index 6bb6ec82dc0..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -package vaults - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VaultList -} - -// List ... -func (c VaultsClient) List(ctx context.Context, id NetAppAccountId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/vaults", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/vaults/model_vault.go b/resource-manager/netapp/2022-05-01/vaults/model_vault.go deleted file mode 100644 index 3eb9099c1ba..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/model_vault.go +++ /dev/null @@ -1,11 +0,0 @@ -package vaults - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Vault struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties VaultProperties `json:"properties"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/vaults/model_vaultlist.go b/resource-manager/netapp/2022-05-01/vaults/model_vaultlist.go deleted file mode 100644 index c152c315d35..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/model_vaultlist.go +++ /dev/null @@ -1,8 +0,0 @@ -package vaults - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VaultList struct { - Value *[]Vault `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/vaults/model_vaultproperties.go b/resource-manager/netapp/2022-05-01/vaults/model_vaultproperties.go deleted file mode 100644 index 3168733b9f5..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/model_vaultproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package vaults - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VaultProperties struct { - VaultName *string `json:"vaultName,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/vaults/version.go b/resource-manager/netapp/2022-05-01/vaults/version.go deleted file mode 100644 index ba869702570..00000000000 --- a/resource-manager/netapp/2022-05-01/vaults/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package vaults - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/vaults/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/README.md b/resource-manager/netapp/2022-05-01/volumegroups/README.md deleted file mode 100644 index 29f999291cd..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/README.md +++ /dev/null @@ -1,81 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumegroups` Documentation - -The `volumegroups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/volumegroups" -``` - - -### Client Initialization - -```go -client := volumegroups.NewVolumeGroupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeGroupsClient.Create` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -payload := volumegroups.VolumeGroupDetails{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Delete` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Get` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -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: `VolumeGroupsClient.ListByNetAppAccount` - -```go -ctx := context.TODO() -id := volumegroups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.ListByNetAppAccount(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-05-01/volumegroups/client.go b/resource-manager/netapp/2022-05-01/volumegroups/client.go deleted file mode 100644 index a117e697f04..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient struct { - Client *resourcemanager.Client -} - -func NewVolumeGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeGroupsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumegroups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) - } - - return &VolumeGroupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/constants.go b/resource-manager/netapp/2022-05-01/volumegroups/constants.go deleted file mode 100644 index 26f54a822f6..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/constants.go +++ /dev/null @@ -1,552 +0,0 @@ -package volumegroups - -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 ApplicationType string - -const ( - ApplicationTypeSAPNegativeHANA ApplicationType = "SAP-HANA" -) - -func PossibleValuesForApplicationType() []string { - return []string{ - string(ApplicationTypeSAPNegativeHANA), - } -} - -func (s *ApplicationType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseApplicationType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseApplicationType(input string) (*ApplicationType, error) { - vals := map[string]ApplicationType{ - "sap-hana": ApplicationTypeSAPNegativeHANA, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ApplicationType(input) - return &out, nil -} - -type AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go deleted file mode 100644 index 180947b711b..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount_test.go b/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount_test.go deleted file mode 100644 index 42d30d6c431..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go deleted file mode 100644 index f97a6bb10bd..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -// VolumeGroupId is a struct representing the Resource ID for a Volume Group -type VolumeGroupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - VolumeGroupName string -} - -// NewVolumeGroupID returns a new VolumeGroupId struct -func NewVolumeGroupID(subscriptionId string, resourceGroupName string, netAppAccountName string, volumeGroupName string) VolumeGroupId { - return VolumeGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - VolumeGroupName: volumeGroupName, - } -} - -// ParseVolumeGroupID parses 'input' into a VolumeGroupId -func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeGroupIDInsensitively parses 'input' case-insensitively into a VolumeGroupId -// note: this method should only be used for API response data and not user input -func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeGroupId) 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.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) - } - - return nil -} - -// ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID -func ValidateVolumeGroupID(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 := ParseVolumeGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Group ID -func (id VolumeGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/volumeGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.VolumeGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Group ID -func (id VolumeGroupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticVolumeGroups", "volumeGroups", "volumeGroups"), - resourceids.UserSpecifiedSegment("volumeGroupName", "volumeGroupValue"), - } -} - -// String returns a human-readable description of this Volume Group ID -func (id VolumeGroupId) 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("Volume Group Name: %q", id.VolumeGroupName), - } - return fmt.Sprintf("Volume Group (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup_test.go b/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup_test.go deleted file mode 100644 index d8c69411672..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/id_volumegroup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -func TestNewVolumeGroupID(t *testing.T) { - id := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.VolumeGroupName != "volumeGroupValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeGroupName'", id.VolumeGroupName, "volumeGroupValue") - } -} - -func TestFormatVolumeGroupID(t *testing.T) { - actual := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestParseVolumeGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - VolumeGroupName: "vOlUmEgRoUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestSegmentsForVolumeGroupId(t *testing.T) { - segments := VolumeGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/method_create.go b/resource-manager/netapp/2022-05-01/volumegroups/method_create.go deleted file mode 100644 index 13500e108f3..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/method_create.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumegroups - -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 -} - -// Create ... -func (c VolumeGroupsClient) Create(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - }, - 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 VolumeGroupsClient) CreateThenPoll(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) 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/resource-manager/netapp/2022-05-01/volumegroups/method_delete.go b/resource-manager/netapp/2022-05-01/volumegroups/method_delete.go deleted file mode 100644 index 32e6c75b150..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient) Delete(ctx context.Context, id VolumeGroupId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeGroupsClient) DeleteThenPoll(ctx context.Context, id VolumeGroupId) 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/resource-manager/netapp/2022-05-01/volumegroups/method_get.go b/resource-manager/netapp/2022-05-01/volumegroups/method_get.go deleted file mode 100644 index 6a14cec40c4..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumegroups - -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 *VolumeGroupDetails -} - -// Get ... -func (c VolumeGroupsClient) Get(ctx context.Context, id VolumeGroupId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/method_listbynetappaccount.go b/resource-manager/netapp/2022-05-01/volumegroups/method_listbynetappaccount.go deleted file mode 100644 index 0a84dcdd8e0..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/method_listbynetappaccount.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumegroups - -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 *VolumeGroupList -} - -// ListByNetAppAccount ... -func (c VolumeGroupsClient) 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, - Path: fmt.Sprintf("%s/volumeGroups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_exportpolicyrule.go b/resource-manager/netapp/2022-05-01/volumegroups/model_exportpolicyrule.go deleted file mode 100644 index e17395ba1a7..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -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 ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_mounttargetproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_mounttargetproperties.go deleted file mode 100644 index 5844b80ce9d..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -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 MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-05-01/volumegroups/model_placementkeyvaluepairs.go deleted file mode 100644 index 1714b1662a1..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -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 PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_replicationobject.go b/resource-manager/netapp/2022-05-01/volumegroups/model_replicationobject.go deleted file mode 100644 index 6d145aa0079..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -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 ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumebackupproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumebackupproperties.go deleted file mode 100644 index 1141229b560..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumebackupproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -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 { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` - VaultId *string `json:"vaultId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroup.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroup.go deleted file mode 100644 index 5e4df7bb9c0..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroup.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroup struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupListProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupdetails.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupdetails.go deleted file mode 100644 index 5f01af82c0f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupdetails.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupDetails struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplist.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplist.go deleted file mode 100644 index 447c6e6e858..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeGroupList struct { - Value *[]VolumeGroup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplistproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplistproperties.go deleted file mode 100644 index 5788ee516fc..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegrouplistproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeGroupListProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupmetadata.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupmetadata.go deleted file mode 100644 index 30441c6826d..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupmetadata.go +++ /dev/null @@ -1,13 +0,0 @@ -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 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/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupproperties.go deleted file mode 100644 index 0bab153b397..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -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 VolumeGroupProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Volumes *[]VolumeGroupVolumeProperties `json:"volumes,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupvolumeproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupvolumeproperties.go deleted file mode 100644 index 61bbdab9ce3..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumegroupvolumeproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupVolumeProperties struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumeproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumeproperties.go deleted file mode 100644 index bf37d27af94..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumeproperties.go +++ /dev/null @@ -1,54 +0,0 @@ -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 VolumeProperties struct { - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesdataprotection.go deleted file mode 100644 index 5cde3ecbaac..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,10 +0,0 @@ -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 VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 227c8586d6f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-05-01/volumegroups/model_volumesnapshotproperties.go deleted file mode 100644 index a3f5011da3b..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumegroups/version.go b/resource-manager/netapp/2022-05-01/volumegroups/version.go deleted file mode 100644 index 30dbbd9db03..00000000000 --- a/resource-manager/netapp/2022-05-01/volumegroups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumegroups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumegroups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/README.md b/resource-manager/netapp/2022-05-01/volumequotarules/README.md deleted file mode 100644 index 475baa381e1..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumequotarules` Documentation - -The `volumequotarules` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/volumequotarules" -``` - - -### Client Initialization - -```go -client := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeQuotaRulesClient.Create` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRule{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Delete` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Get` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -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: `VolumeQuotaRulesClient.ListByVolume` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.ListByVolume(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Update` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRulePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/client.go b/resource-manager/netapp/2022-05-01/volumequotarules/client.go deleted file mode 100644 index c6c70e112e0..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient struct { - Client *resourcemanager.Client -} - -func NewVolumeQuotaRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeQuotaRulesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumequotarules", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) - } - - return &VolumeQuotaRulesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/constants.go b/resource-manager/netapp/2022-05-01/volumequotarules/constants.go deleted file mode 100644 index fb0e41e1afb..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/constants.go +++ /dev/null @@ -1,113 +0,0 @@ -package volumequotarules - -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 ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStatePatching ProvisioningState = "Patching" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateMoving), - string(ProvisioningStatePatching), - string(ProvisioningStateSucceeded), - } -} - -func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseProvisioningState(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "moving": ProvisioningStateMoving, - "patching": ProvisioningStatePatching, - "succeeded": ProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type Type string - -const ( - TypeDefaultGroupQuota Type = "DefaultGroupQuota" - TypeDefaultUserQuota Type = "DefaultUserQuota" - TypeIndividualGroupQuota Type = "IndividualGroupQuota" - TypeIndividualUserQuota Type = "IndividualUserQuota" -) - -func PossibleValuesForType() []string { - return []string{ - string(TypeDefaultGroupQuota), - string(TypeDefaultUserQuota), - string(TypeIndividualGroupQuota), - string(TypeIndividualUserQuota), - } -} - -func (s *Type) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseType(input string) (*Type, error) { - vals := map[string]Type{ - "defaultgroupquota": TypeDefaultGroupQuota, - "defaultuserquota": TypeDefaultUserQuota, - "individualgroupquota": TypeIndividualGroupQuota, - "individualuserquota": TypeIndividualUserQuota, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Type(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go b/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go deleted file mode 100644 index b3d6ab761b3..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/volumequotarules/id_volume_test.go b/resource-manager/netapp/2022-05-01/volumequotarules/id_volume_test.go deleted file mode 100644 index 98a3bd4ff39..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go deleted file mode 100644 index 711a80ae5cd..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule.go +++ /dev/null @@ -1,152 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -// VolumeQuotaRuleId is a struct representing the Resource ID for a Volume Quota Rule -type VolumeQuotaRuleId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - VolumeQuotaRuleName string -} - -// NewVolumeQuotaRuleID returns a new VolumeQuotaRuleId struct -func NewVolumeQuotaRuleID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, volumeQuotaRuleName string) VolumeQuotaRuleId { - return VolumeQuotaRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - VolumeQuotaRuleName: volumeQuotaRuleName, - } -} - -// ParseVolumeQuotaRuleID parses 'input' into a VolumeQuotaRuleId -func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeQuotaRuleIDInsensitively parses 'input' case-insensitively into a VolumeQuotaRuleId -// note: this method should only be used for API response data and not user input -func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeQuotaRuleId) 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) - } - - if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) - } - - return nil -} - -// ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID -func ValidateVolumeQuotaRuleID(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 := ParseVolumeQuotaRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Quota Rule ID -func (id VolumeQuotaRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/volumeQuotaRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.VolumeQuotaRuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticVolumeQuotaRules", "volumeQuotaRules", "volumeQuotaRules"), - resourceids.UserSpecifiedSegment("volumeQuotaRuleName", "volumeQuotaRuleValue"), - } -} - -// String returns a human-readable description of this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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), - fmt.Sprintf("Volume Quota Rule Name: %q", id.VolumeQuotaRuleName), - } - return fmt.Sprintf("Volume Quota Rule (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule_test.go b/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule_test.go deleted file mode 100644 index a6f3c9d15ab..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/id_volumequotarule_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -func TestNewVolumeQuotaRuleID(t *testing.T) { - id := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.VolumeQuotaRuleName != "volumeQuotaRuleValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeQuotaRuleName'", id.VolumeQuotaRuleName, "volumeQuotaRuleValue") - } -} - -func TestFormatVolumeQuotaRuleID(t *testing.T) { - actual := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeQuotaRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestParseVolumeQuotaRuleIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - VolumeQuotaRuleName: "vOlUmEqUoTaRuLeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestSegmentsForVolumeQuotaRuleId(t *testing.T) { - segments := VolumeQuotaRuleId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeQuotaRuleId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/method_create.go b/resource-manager/netapp/2022-05-01/volumequotarules/method_create.go deleted file mode 100644 index f052dfadc2f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Create ... -func (c VolumeQuotaRulesClient) Create(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) (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 VolumeQuotaRulesClient) CreateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) 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/resource-manager/netapp/2022-05-01/volumequotarules/method_delete.go b/resource-manager/netapp/2022-05-01/volumequotarules/method_delete.go deleted file mode 100644 index f490494d054..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/method_delete.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient) Delete(ctx context.Context, id VolumeQuotaRuleId) (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 VolumeQuotaRulesClient) DeleteThenPoll(ctx context.Context, id VolumeQuotaRuleId) 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/resource-manager/netapp/2022-05-01/volumequotarules/method_get.go b/resource-manager/netapp/2022-05-01/volumequotarules/method_get.go deleted file mode 100644 index bed8822bc79..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumequotarules - -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 *VolumeQuotaRule -} - -// Get ... -func (c VolumeQuotaRulesClient) Get(ctx context.Context, id VolumeQuotaRuleId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/method_listbyvolume.go b/resource-manager/netapp/2022-05-01/volumequotarules/method_listbyvolume.go deleted file mode 100644 index 1bdc8b8007c..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/method_listbyvolume.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumequotarules - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VolumeQuotaRulesList -} - -// ListByVolume ... -func (c VolumeQuotaRulesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumeQuotaRules", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/method_update.go b/resource-manager/netapp/2022-05-01/volumequotarules/method_update.go deleted file mode 100644 index 2201827bac1..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Update ... -func (c VolumeQuotaRulesClient) Update(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) (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 VolumeQuotaRulesClient) UpdateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) 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/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarule.go b/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarule.go deleted file mode 100644 index 9436f5c0008..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarule.go +++ /dev/null @@ -1,18 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRule struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulepatch.go b/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulepatch.go deleted file mode 100644 index 04e5803959e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulepatch.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulePatch struct { - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotaruleslist.go b/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotaruleslist.go deleted file mode 100644 index d9e15cf8035..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotaruleslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesList struct { - Value *[]VolumeQuotaRule `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulesproperties.go b/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulesproperties.go deleted file mode 100644 index 5ae037e0a23..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/model_volumequotarulesproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesProperties struct { - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - QuotaSizeInKiBs *int64 `json:"quotaSizeInKiBs,omitempty"` - QuotaTarget *string `json:"quotaTarget,omitempty"` - QuotaType *Type `json:"quotaType,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumequotarules/version.go b/resource-manager/netapp/2022-05-01/volumequotarules/version.go deleted file mode 100644 index aa45e3bee31..00000000000 --- a/resource-manager/netapp/2022-05-01/volumequotarules/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumequotarules - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumequotarules/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/volumes/README.md b/resource-manager/netapp/2022-05-01/volumes/README.md deleted file mode 100644 index b28423a5611..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumes` Documentation - -The `volumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/volumes" -``` - - -### Client Initialization - -```go -client := volumes.NewVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.Volume{ - // ... -} - - -if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Delete` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Get` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesClient.List` - -```go -ctx := context.TODO() -id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `VolumesClient.Update` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.VolumePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/volumes/client.go b/resource-manager/netapp/2022-05-01/volumes/client.go deleted file mode 100644 index 9f34fb4a6eb..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumes - -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 VolumesClient struct { - Client *resourcemanager.Client -} - -func NewVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) - } - - return &VolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumes/constants.go b/resource-manager/netapp/2022-05-01/volumes/constants.go deleted file mode 100644 index b31d831c69f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/constants.go +++ /dev/null @@ -1,514 +0,0 @@ -package volumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go b/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go deleted file mode 100644 index 9ce092f4fe4..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-05-01/volumes/id_capacitypool_test.go b/resource-manager/netapp/2022-05-01/volumes/id_capacitypool_test.go deleted file mode 100644 index 055d673d4be..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumes/id_volume.go b/resource-manager/netapp/2022-05-01/volumes/id_volume.go deleted file mode 100644 index 0b27e4a330c..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/volumes/id_volume_test.go b/resource-manager/netapp/2022-05-01/volumes/id_volume_test.go deleted file mode 100644 index 6c6b2858724..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumes/method_createorupdate.go b/resource-manager/netapp/2022-05-01/volumes/method_createorupdate.go deleted file mode 100644 index 87a3cdb945a..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/method_createorupdate.go +++ /dev/null @@ -1,75 +0,0 @@ -package volumes - -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 -} - -// CreateOrUpdate ... -func (c VolumesClient) CreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (result CreateOrUpdateOperationResponse, 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 -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c VolumesClient) CreateOrUpdateThenPoll(ctx context.Context, id VolumeId, input Volume) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumes/method_delete.go b/resource-manager/netapp/2022-05-01/volumes/method_delete.go deleted file mode 100644 index 23734d43ae5..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/method_delete.go +++ /dev/null @@ -1,98 +0,0 @@ -package volumes - -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 -} - -type DeleteOperationOptions struct { - ForceDelete *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o DeleteOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - return &out -} - -func (o DeleteOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.ForceDelete != nil { - out.Append("forceDelete", fmt.Sprintf("%v", *o.ForceDelete)) - } - return &out -} - -// Delete ... -func (c VolumesClient) Delete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (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(), - OptionsObject: options, - } - - 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 VolumesClient) DeleteThenPoll(ctx context.Context, id VolumeId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumes/method_get.go b/resource-manager/netapp/2022-05-01/volumes/method_get.go deleted file mode 100644 index f7865a3e320..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumes - -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 *Volume -} - -// Get ... -func (c VolumesClient) Get(ctx context.Context, id VolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumes/method_list.go b/resource-manager/netapp/2022-05-01/volumes/method_list.go deleted file mode 100644 index aeea477a83f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/method_list.go +++ /dev/null @@ -1,89 +0,0 @@ -package volumes - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]Volume -} - -type ListCompleteResult struct { - Items []Volume -} - -// List ... -func (c VolumesClient) List(ctx context.Context, id CapacityPoolId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 *[]Volume `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListComplete retrieves all the results into a single object -func (c VolumesClient) ListComplete(ctx context.Context, id CapacityPoolId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, VolumeOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c VolumesClient) ListCompleteMatchingPredicate(ctx context.Context, id CapacityPoolId, predicate VolumeOperationPredicate) (result ListCompleteResult, err error) { - items := make([]Volume, 0) - - resp, err := c.List(ctx, id) - if err != nil { - 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 = ListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-05-01/volumes/method_update.go b/resource-manager/netapp/2022-05-01/volumes/method_update.go deleted file mode 100644 index 57573abc0e0..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumes - -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 -} - -// Update ... -func (c VolumesClient) Update(ctx context.Context, id VolumeId, input VolumePatch) (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 VolumesClient) UpdateThenPoll(ctx context.Context, id VolumeId, input VolumePatch) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-05-01/volumes/model_exportpolicyrule.go deleted file mode 100644 index 9b059c74757..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-05-01/volumes/model_mounttargetproperties.go deleted file mode 100644 index 7f5c238183c..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-05-01/volumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 588e9729c1e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_replicationobject.go b/resource-manager/netapp/2022-05-01/volumes/model_replicationobject.go deleted file mode 100644 index b7d6873811e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volume.go b/resource-manager/netapp/2022-05-01/volumes/model_volume.go deleted file mode 100644 index 1679818444b..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package volumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-05-01/volumes/model_volumebackupproperties.go deleted file mode 100644 index 1de25f15e33..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumebackupproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` - VaultId *string `json:"vaultId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumepatch.go b/resource-manager/netapp/2022-05-01/volumes/model_volumepatch.go deleted file mode 100644 index b39ea01aee8..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumepatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumePatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumepatchproperties.go b/resource-manager/netapp/2022-05-01/volumes/model_volumepatchproperties.go deleted file mode 100644 index 5fab8a90ed1..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumepatchproperties.go +++ /dev/null @@ -1,18 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold *int64 `json:"usageThreshold,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesdataprotection.go b/resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesdataprotection.go deleted file mode 100644 index 8c9edc10ff7..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesdataprotection.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesexportpolicy.go b/resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesexportpolicy.go deleted file mode 100644 index ae83a5fc1b4..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumepatchpropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumeproperties.go b/resource-manager/netapp/2022-05-01/volumes/model_volumeproperties.go deleted file mode 100644 index 834a68fdb6e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumeproperties.go +++ /dev/null @@ -1,54 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index 28163c70a51..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,10 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index fda5f4739de..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-05-01/volumes/model_volumesnapshotproperties.go deleted file mode 100644 index 48aba2acce0..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumes/predicates.go b/resource-manager/netapp/2022-05-01/volumes/predicates.go deleted file mode 100644 index fcc54ae5e26..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -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 VolumeOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p VolumeOperationPredicate) Matches(input Volume) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-05-01/volumes/version.go b/resource-manager/netapp/2022-05-01/volumes/version.go deleted file mode 100644 index 9ccb3fd8093..00000000000 --- a/resource-manager/netapp/2022-05-01/volumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/README.md b/resource-manager/netapp/2022-05-01/volumesrelocation/README.md deleted file mode 100644 index 0322dd470b2..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/README.md +++ /dev/null @@ -1,61 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesrelocation` Documentation - -The `volumesrelocation` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/volumesrelocation" -``` - - -### Client Initialization - -```go -client := volumesrelocation.NewVolumesRelocationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRelocationClient.VolumesFinalizeRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesFinalizeRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRelocate` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrelocation.RelocateVolumeRequest{ - // ... -} - - -if err := client.VolumesRelocateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRevertRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesRevertRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/client.go b/resource-manager/netapp/2022-05-01/volumesrelocation/client.go deleted file mode 100644 index 9170c859f6f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrelocation - -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 VolumesRelocationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRelocationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRelocationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrelocation", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) - } - - return &VolumesRelocationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go deleted file mode 100644 index c10d0bf30cd..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrelocation - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume_test.go b/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume_test.go deleted file mode 100644 index 1956a28a604..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrelocation - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesfinalizerelocation.go b/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesfinalizerelocation.go deleted file mode 100644 index 8bc1cc1b39a..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesfinalizerelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesFinalizeRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesFinalizeRelocation ... -func (c VolumesRelocationClient) VolumesFinalizeRelocation(ctx context.Context, id VolumeId) (result VolumesFinalizeRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/finalizeRelocation", 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 -} - -// VolumesFinalizeRelocationThenPoll performs VolumesFinalizeRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesFinalizeRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesFinalizeRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesFinalizeRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesFinalizeRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrelocate.go b/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrelocate.go deleted file mode 100644 index 1207d489ed4..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrelocate.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrelocation - -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 VolumesRelocateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRelocate ... -func (c VolumesRelocationClient) VolumesRelocate(ctx context.Context, id VolumeId, input RelocateVolumeRequest) (result VolumesRelocateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/relocate", 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 -} - -// VolumesRelocateThenPoll performs VolumesRelocate then polls until it's completed -func (c VolumesRelocationClient) VolumesRelocateThenPoll(ctx context.Context, id VolumeId, input RelocateVolumeRequest) error { - result, err := c.VolumesRelocate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRelocate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRelocate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrevertrelocation.go b/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrevertrelocation.go deleted file mode 100644 index 0091b1304fd..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/method_volumesrevertrelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesRevertRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevertRelocation ... -func (c VolumesRelocationClient) VolumesRevertRelocation(ctx context.Context, id VolumeId) (result VolumesRevertRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revertRelocation", 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 -} - -// VolumesRevertRelocationThenPoll performs VolumesRevertRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesRevertRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesRevertRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesRevertRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevertRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/model_relocatevolumerequest.go b/resource-manager/netapp/2022-05-01/volumesrelocation/model_relocatevolumerequest.go deleted file mode 100644 index 25cb3a56801..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/model_relocatevolumerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrelocation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RelocateVolumeRequest struct { - CreationToken *string `json:"creationToken,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesrelocation/version.go b/resource-manager/netapp/2022-05-01/volumesrelocation/version.go deleted file mode 100644 index 4764fd5cf07..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrelocation/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrelocation - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrelocation/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/README.md b/resource-manager/netapp/2022-05-01/volumesreplication/README.md deleted file mode 100644 index 204a786e6dd..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/README.md +++ /dev/null @@ -1,139 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesreplication` Documentation - -The `volumesreplication` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/volumesreplication" -``` - - -### Client Initialization - -```go -client := volumesreplication.NewVolumesReplicationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesReplicationClient.VolumesAuthorizeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.AuthorizeRequest{ - // ... -} - - -if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesBreakReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.BreakReplicationRequest{ - // ... -} - - -if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesDeleteReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesListReplications` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesListReplications(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReInitializeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReestablishReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.ReestablishReplicationRequest{ - // ... -} - - -if err := client.VolumesReestablishReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReplicationStatus` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesReplicationStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesResyncReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/client.go b/resource-manager/netapp/2022-05-01/volumesreplication/client.go deleted file mode 100644 index 278506e484e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesreplication - -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 VolumesReplicationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesReplicationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesReplicationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesreplication", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) - } - - return &VolumesReplicationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/constants.go b/resource-manager/netapp/2022-05-01/volumesreplication/constants.go deleted file mode 100644 index 2e5196391b7..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/constants.go +++ /dev/null @@ -1,180 +0,0 @@ -package volumesreplication - -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 EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go b/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go deleted file mode 100644 index c68d5f31c45..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesreplication - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/volumesreplication/id_volume_test.go b/resource-manager/netapp/2022-05-01/volumesreplication/id_volume_test.go deleted file mode 100644 index b7b6501115b..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesreplication - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesauthorizereplication.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesauthorizereplication.go deleted file mode 100644 index 591d7c626ab..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesauthorizereplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesAuthorizeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesAuthorizeReplication ... -func (c VolumesReplicationClient) VolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (result VolumesAuthorizeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/authorizeReplication", 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 -} - -// VolumesAuthorizeReplicationThenPoll performs VolumesAuthorizeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesAuthorizeReplicationThenPoll(ctx context.Context, id VolumeId, input AuthorizeRequest) error { - result, err := c.VolumesAuthorizeReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesAuthorizeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesAuthorizeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesbreakreplication.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesbreakreplication.go deleted file mode 100644 index 280008e8175..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesbreakreplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesBreakReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakReplication ... -func (c VolumesReplicationClient) VolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (result VolumesBreakReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakReplication", 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 -} - -// VolumesBreakReplicationThenPoll performs VolumesBreakReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesBreakReplicationThenPoll(ctx context.Context, id VolumeId, input BreakReplicationRequest) error { - result, err := c.VolumesBreakReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesdeletereplication.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesdeletereplication.go deleted file mode 100644 index cda9737c512..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesdeletereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesDeleteReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesDeleteReplication ... -func (c VolumesReplicationClient) VolumesDeleteReplication(ctx context.Context, id VolumeId) (result VolumesDeleteReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/deleteReplication", 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 -} - -// VolumesDeleteReplicationThenPoll performs VolumesDeleteReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesDeleteReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesDeleteReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesDeleteReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesDeleteReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumeslistreplications.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumeslistreplications.go deleted file mode 100644 index c85aaaca41b..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumeslistreplications.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesListReplicationsOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ListReplications -} - -// VolumesListReplications ... -func (c VolumesReplicationClient) VolumesListReplications(ctx context.Context, id VolumeId) (result VolumesListReplicationsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/listReplications", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreestablishreplication.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreestablishreplication.go deleted file mode 100644 index 047fc04a7f9..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreestablishreplication.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumesreplication - -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 VolumesReestablishReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReestablishReplication ... -func (c VolumesReplicationClient) VolumesReestablishReplication(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) (result VolumesReestablishReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reestablishReplication", 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 -} - -// VolumesReestablishReplicationThenPoll performs VolumesReestablishReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReestablishReplicationThenPoll(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) error { - result, err := c.VolumesReestablishReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesReestablishReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReestablishReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreinitializereplication.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreinitializereplication.go deleted file mode 100644 index 3f479bf637a..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreinitializereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesReInitializeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReInitializeReplication ... -func (c VolumesReplicationClient) VolumesReInitializeReplication(ctx context.Context, id VolumeId) (result VolumesReInitializeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reinitializeReplication", 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 -} - -// VolumesReInitializeReplicationThenPoll performs VolumesReInitializeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReInitializeReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesReInitializeReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesReInitializeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReInitializeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreplicationstatus.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreplicationstatus.go deleted file mode 100644 index af1138c5648..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesreplicationstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesReplicationStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ReplicationStatus -} - -// VolumesReplicationStatus ... -func (c VolumesReplicationClient) VolumesReplicationStatus(ctx context.Context, id VolumeId) (result VolumesReplicationStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/replicationStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesresyncreplication.go b/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesresyncreplication.go deleted file mode 100644 index 23e1a66f518..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/method_volumesresyncreplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesResyncReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResyncReplication ... -func (c VolumesReplicationClient) VolumesResyncReplication(ctx context.Context, id VolumeId) (result VolumesResyncReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resyncReplication", 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 -} - -// VolumesResyncReplicationThenPoll performs VolumesResyncReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesResyncReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResyncReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResyncReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResyncReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/model_authorizerequest.go b/resource-manager/netapp/2022-05-01/volumesreplication/model_authorizerequest.go deleted file mode 100644 index ff1cefa31ef..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/model_authorizerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthorizeRequest struct { - RemoteVolumeResourceId *string `json:"remoteVolumeResourceId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/model_breakreplicationrequest.go b/resource-manager/netapp/2022-05-01/volumesreplication/model_breakreplicationrequest.go deleted file mode 100644 index b6a0a179a9c..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/model_breakreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakReplicationRequest struct { - ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/model_listreplications.go b/resource-manager/netapp/2022-05-01/volumesreplication/model_listreplications.go deleted file mode 100644 index 7929ea4ace4..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/model_listreplications.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListReplications struct { - Value *[]Replication `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/model_reestablishreplicationrequest.go b/resource-manager/netapp/2022-05-01/volumesreplication/model_reestablishreplicationrequest.go deleted file mode 100644 index 193b71f1490..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/model_reestablishreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReestablishReplicationRequest struct { - SourceVolumeId *string `json:"sourceVolumeId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/model_replication.go b/resource-manager/netapp/2022-05-01/volumesreplication/model_replication.go deleted file mode 100644 index 06e345fdb5e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/model_replication.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Replication struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/model_replicationstatus.go b/resource-manager/netapp/2022-05-01/volumesreplication/model_replicationstatus.go deleted file mode 100644 index 2a79dddf7a4..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/model_replicationstatus.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalProgress *string `json:"totalProgress,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesreplication/version.go b/resource-manager/netapp/2022-05-01/volumesreplication/version.go deleted file mode 100644 index 5bed92cb09f..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesreplication/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesreplication/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/README.md b/resource-manager/netapp/2022-05-01/volumesrevert/README.md deleted file mode 100644 index 498f98db97e..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-05-01/volumesrevert` Documentation - -The `volumesrevert` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-05-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/2022-05-01/volumesrevert" -``` - - -### Client Initialization - -```go -client := volumesrevert.NewVolumesRevertClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRevertClient.VolumesRevert` - -```go -ctx := context.TODO() -id := volumesrevert.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrevert.VolumeRevert{ - // ... -} - - -if err := client.VolumesRevertThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/client.go b/resource-manager/netapp/2022-05-01/volumesrevert/client.go deleted file mode 100644 index fa2bad78d7b..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrevert - -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 VolumesRevertClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRevertClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRevertClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrevert", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) - } - - return &VolumesRevertClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go b/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go deleted file mode 100644 index 576a30b9904..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrevert - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-05-01/volumesrevert/id_volume_test.go b/resource-manager/netapp/2022-05-01/volumesrevert/id_volume_test.go deleted file mode 100644 index 46df3f272f2..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrevert - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/method_volumesrevert.go b/resource-manager/netapp/2022-05-01/volumesrevert/method_volumesrevert.go deleted file mode 100644 index 0be129fdd47..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/method_volumesrevert.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrevert - -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 VolumesRevertOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevert ... -func (c VolumesRevertClient) VolumesRevert(ctx context.Context, id VolumeId, input VolumeRevert) (result VolumesRevertOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revert", 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 -} - -// VolumesRevertThenPoll performs VolumesRevert then polls until it's completed -func (c VolumesRevertClient) VolumesRevertThenPoll(ctx context.Context, id VolumeId, input VolumeRevert) error { - result, err := c.VolumesRevert(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRevert: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevert: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/model_volumerevert.go b/resource-manager/netapp/2022-05-01/volumesrevert/model_volumerevert.go deleted file mode 100644 index c5adf461cf8..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/model_volumerevert.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrevert - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRevert struct { - SnapshotId *string `json:"snapshotId,omitempty"` -} diff --git a/resource-manager/netapp/2022-05-01/volumesrevert/version.go b/resource-manager/netapp/2022-05-01/volumesrevert/version.go deleted file mode 100644 index cf24ef21cad..00000000000 --- a/resource-manager/netapp/2022-05-01/volumesrevert/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrevert - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-05-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrevert/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/README.md b/resource-manager/netapp/2022-09-01/backuppolicy/README.md deleted file mode 100644 index e58790355f3..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/backuppolicy` Documentation - -The `backuppolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue") - -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", "netAppAccountValue", "backupPolicyValue") - -payload := backuppolicy.BackupPolicyPatch{ - // ... -} - - -if err := client.BackupPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/client.go b/resource-manager/netapp/2022-09-01/backuppolicy/client.go deleted file mode 100644 index 1db45e634e5..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backuppolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) - } - - return &BackupPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go deleted file mode 100644 index f16f0b462b8..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), - resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy_test.go b/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy_test.go deleted file mode 100644 index 577058e02d3..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/id_backuppolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupPolicyId{} - -func TestNewBackupPolicyID(t *testing.T) { - id := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupPolicyName != "backupPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupPolicyName'", id.BackupPolicyName, "backupPolicyValue") - } -} - -func TestFormatBackupPolicyID(t *testing.T) { - actual := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestParseBackupPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupPolicyName: "bAcKuPpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestSegmentsForBackupPolicyId(t *testing.T) { - segments := BackupPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go deleted file mode 100644 index 6b11cb40365..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount_test.go deleted file mode 100644 index 2d0f311d8d1..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciescreate.go b/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciescreate.go deleted file mode 100644 index f0b9cef4c28..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciescreate.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesdelete.go b/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesdelete.go deleted file mode 100644 index 482cdc1780e..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesget.go b/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesget.go deleted file mode 100644 index 95b4f6f56a8..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppolicieslist.go b/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppolicieslist.go deleted file mode 100644 index 2730e8afc34..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesupdate.go b/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesupdate.go deleted file mode 100644 index 8e5456d63ac..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/method_backuppoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicieslist.go b/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicieslist.go deleted file mode 100644 index 3db3d131a60..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicy.go b/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicy.go deleted file mode 100644 index 747ab65be24..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -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/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicypatch.go b/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicypatch.go deleted file mode 100644 index bf7eecb1358..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -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/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicyproperties.go b/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicyproperties.go deleted file mode 100644 index d5694f4797d..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/model_backuppolicyproperties.go +++ /dev/null @@ -1,15 +0,0 @@ -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/resource-manager/netapp/2022-09-01/backuppolicy/model_volumebackups.go b/resource-manager/netapp/2022-09-01/backuppolicy/model_volumebackups.go deleted file mode 100644 index c01a5c25fd5..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/model_volumebackups.go +++ /dev/null @@ -1,10 +0,0 @@ -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"` -} diff --git a/resource-manager/netapp/2022-09-01/backuppolicy/version.go b/resource-manager/netapp/2022-09-01/backuppolicy/version.go deleted file mode 100644 index 08db5fee555..00000000000 --- a/resource-manager/netapp/2022-09-01/backuppolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backuppolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backuppolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/backups/README.md b/resource-manager/netapp/2022-09-01/backups/README.md deleted file mode 100644 index 68d494fc8d4..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/README.md +++ /dev/null @@ -1,175 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/backups` Documentation - -The `backups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/backups" -``` - - -### Client Initialization - -```go -client := backups.NewBackupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupsClient.AccountBackupsDelete` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -if err := client.AccountBackupsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsGet` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -read, err := client.AccountBackupsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsList` - -```go -ctx := context.TODO() -id := backups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountBackupsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.Create` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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.GetStatus` - -```go -ctx := context.TODO() -id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.GetStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.List` - -```go -ctx := context.TODO() -id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.RestoreFiles` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -payload := backups.BackupRestoreFiles{ - // ... -} - - -if err := client.RestoreFilesThenPoll(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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -payload := backups.BackupPatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/backups/client.go b/resource-manager/netapp/2022-09-01/backups/client.go deleted file mode 100644 index a0f81d2a6ab..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) - } - - return &BackupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/backups/constants.go b/resource-manager/netapp/2022-09-01/backups/constants.go deleted file mode 100644 index e2ac45e345b..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/constants.go +++ /dev/null @@ -1,136 +0,0 @@ -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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go b/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go deleted file mode 100644 index b4091d27265..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_accountbackup.go +++ /dev/null @@ -1,134 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -// AccountBackupId is a struct representing the Resource ID for a Account Backup -type AccountBackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - AccountBackupName string -} - -// NewAccountBackupID returns a new AccountBackupId struct -func NewAccountBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, accountBackupName string) AccountBackupId { - return AccountBackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - AccountBackupName: accountBackupName, - } -} - -// ParseAccountBackupID parses 'input' into a AccountBackupId -func ParseAccountBackupID(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseAccountBackupIDInsensitively parses 'input' case-insensitively into a AccountBackupId -// note: this method should only be used for API response data and not user input -func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *AccountBackupId) 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.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) - } - - return nil -} - -// ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID -func ValidateAccountBackupID(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 := ParseAccountBackupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account Backup ID -func (id AccountBackupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/accountBackups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.AccountBackupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account Backup ID -func (id AccountBackupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticAccountBackups", "accountBackups", "accountBackups"), - resourceids.UserSpecifiedSegment("accountBackupName", "accountBackupValue"), - } -} - -// String returns a human-readable description of this Account Backup ID -func (id AccountBackupId) 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("Account Backup Name: %q", id.AccountBackupName), - } - return fmt.Sprintf("Account Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/backups/id_accountbackup_test.go b/resource-manager/netapp/2022-09-01/backups/id_accountbackup_test.go deleted file mode 100644 index 5371bde3e0a..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_accountbackup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -func TestNewAccountBackupID(t *testing.T) { - id := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.AccountBackupName != "accountBackupValue" { - t.Fatalf("Expected %q but got %q for Segment 'AccountBackupName'", id.AccountBackupName, "accountBackupValue") - } -} - -func TestFormatAccountBackupID(t *testing.T) { - actual := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseAccountBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestParseAccountBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - AccountBackupName: "aCcOuNtBaCkUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestSegmentsForAccountBackupId(t *testing.T) { - segments := AccountBackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("AccountBackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/backups/id_backup.go b/resource-manager/netapp/2022-09-01/backups/id_backup.go deleted file mode 100644 index 9c95bd9350f..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_backup.go +++ /dev/null @@ -1,152 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -// BackupId is a struct representing the Resource ID for a Backup -type BackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - BackupName string -} - -// NewBackupID returns a new BackupId struct -func NewBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, backupName string) BackupId { - return BackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - 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.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) - } - - 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/capacityPools/%s/volumes/%s/backups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticBackups", "backups", "backups"), - resourceids.UserSpecifiedSegment("backupName", "backupValue"), - } -} - -// 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("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Backup Name: %q", id.BackupName), - } - return fmt.Sprintf("Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/backups/id_backup_test.go b/resource-manager/netapp/2022-09-01/backups/id_backup_test.go deleted file mode 100644 index e6ca856e47e..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_backup_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -func TestNewBackupID(t *testing.T) { - id := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.BackupName != "backupValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupName'", id.BackupName, "backupValue") - } -} - -func TestFormatBackupID(t *testing.T) { - actual := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestParseBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs/bAcKuPvAlUe", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - BackupName: "bAcKuPvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs/bAcKuPvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestSegmentsForBackupId(t *testing.T) { - segments := BackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go b/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go deleted file mode 100644 index ced6c2088e0..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/backups/id_netappaccount_test.go b/resource-manager/netapp/2022-09-01/backups/id_netappaccount_test.go deleted file mode 100644 index bc4a37eeffd..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/backups/id_volume.go b/resource-manager/netapp/2022-09-01/backups/id_volume.go deleted file mode 100644 index 247b20b073e..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/backups/id_volume_test.go b/resource-manager/netapp/2022-09-01/backups/id_volume_test.go deleted file mode 100644 index d8f88fb84a4..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_accountbackupsdelete.go b/resource-manager/netapp/2022-09-01/backups/method_accountbackupsdelete.go deleted file mode 100644 index a55df55cf2e..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_accountbackupsdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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 AccountBackupsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountBackupsDelete ... -func (c BackupsClient) AccountBackupsDelete(ctx context.Context, id AccountBackupId) (result AccountBackupsDeleteOperationResponse, 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 -} - -// AccountBackupsDeleteThenPoll performs AccountBackupsDelete then polls until it's completed -func (c BackupsClient) AccountBackupsDeleteThenPoll(ctx context.Context, id AccountBackupId) error { - result, err := c.AccountBackupsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountBackupsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountBackupsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_accountbackupsget.go b/resource-manager/netapp/2022-09-01/backups/method_accountbackupsget.go deleted file mode 100644 index 1f242db5125..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_accountbackupsget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 AccountBackupsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *Backup -} - -// AccountBackupsGet ... -func (c BackupsClient) AccountBackupsGet(ctx context.Context, id AccountBackupId) (result AccountBackupsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_accountbackupslist.go b/resource-manager/netapp/2022-09-01/backups/method_accountbackupslist.go deleted file mode 100644 index 702e9d3951d..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_accountbackupslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 AccountBackupsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -// AccountBackupsList ... -func (c BackupsClient) AccountBackupsList(ctx context.Context, id NetAppAccountId) (result AccountBackupsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/accountBackups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_create.go b/resource-manager/netapp/2022-09-01/backups/method_create.go deleted file mode 100644 index 0e97dd6521a..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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.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 -} - -// 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/resource-manager/netapp/2022-09-01/backups/method_delete.go b/resource-manager/netapp/2022-09-01/backups/method_delete.go deleted file mode 100644 index 3472a05fa69..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -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, - 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 -} - -// 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/resource-manager/netapp/2022-09-01/backups/method_get.go b/resource-manager/netapp/2022-09-01/backups/method_get.go deleted file mode 100644 index 4ea8ec97737..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_getstatus.go b/resource-manager/netapp/2022-09-01/backups/method_getstatus.go deleted file mode 100644 index 0fed6c10cee..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_getstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -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 GetStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupStatus -} - -// GetStatus ... -func (c BackupsClient) GetStatus(ctx context.Context, id VolumeId) (result GetStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/backupStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_list.go b/resource-manager/netapp/2022-09-01/backups/method_list.go deleted file mode 100644 index f88403c6c9f..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -// List ... -func (c BackupsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - 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.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_restorefiles.go b/resource-manager/netapp/2022-09-01/backups/method_restorefiles.go deleted file mode 100644 index 1926e145afb..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_restorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -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 RestoreFilesOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// RestoreFiles ... -func (c BackupsClient) RestoreFiles(ctx context.Context, id BackupId, input BackupRestoreFiles) (result RestoreFilesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - 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 -} - -// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed -func (c BackupsClient) RestoreFilesThenPoll(ctx context.Context, id BackupId, input BackupRestoreFiles) error { - result, err := c.RestoreFiles(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RestoreFiles: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after RestoreFiles: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/backups/method_update.go b/resource-manager/netapp/2022-09-01/backups/method_update.go deleted file mode 100644 index 38c6398f381..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-09-01/backups/model_backup.go b/resource-manager/netapp/2022-09-01/backups/model_backup.go deleted file mode 100644 index d3f65f0a7d1..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/model_backup.go +++ /dev/null @@ -1,17 +0,0 @@ -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"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties BackupProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/backups/model_backuppatch.go b/resource-manager/netapp/2022-09-01/backups/model_backuppatch.go deleted file mode 100644 index 5354276c3d2..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/model_backuppatch.go +++ /dev/null @@ -1,9 +0,0 @@ -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 *BackupProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/backups/model_backupproperties.go b/resource-manager/netapp/2022-09-01/backups/model_backupproperties.go deleted file mode 100644 index 800c6da1e29..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/model_backupproperties.go +++ /dev/null @@ -1,34 +0,0 @@ -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"` - 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"` - UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` - VolumeName *string `json:"volumeName,omitempty"` -} - -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/resource-manager/netapp/2022-09-01/backups/model_backuprestorefiles.go b/resource-manager/netapp/2022-09-01/backups/model_backuprestorefiles.go deleted file mode 100644 index e26ce886407..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/model_backuprestorefiles.go +++ /dev/null @@ -1,10 +0,0 @@ -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/resource-manager/netapp/2022-09-01/backups/model_backupslist.go b/resource-manager/netapp/2022-09-01/backups/model_backupslist.go deleted file mode 100644 index d2e3929dbc7..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/model_backupslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 BackupsList struct { - Value *[]Backup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/backups/model_backupstatus.go b/resource-manager/netapp/2022-09-01/backups/model_backupstatus.go deleted file mode 100644 index 28d092897d7..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/model_backupstatus.go +++ /dev/null @@ -1,15 +0,0 @@ -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"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/backups/version.go b/resource-manager/netapp/2022-09-01/backups/version.go deleted file mode 100644 index 50b163c97b1..00000000000 --- a/resource-manager/netapp/2022-09-01/backups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/README.md b/resource-manager/netapp/2022-09-01/capacitypools/README.md deleted file mode 100644 index 00028eb47a6..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/capacitypools` Documentation - -The `capacitypools` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/capacitypools" -``` - - -### Client Initialization - -```go -client := capacitypools.NewCapacityPoolsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `CapacityPoolsClient.PoolsCreateOrUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPool{ - // ... -} - - -if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsDelete` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsGet` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -read, err := client.PoolsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsList` - -```go -ctx := context.TODO() -id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -// alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination -items, err := client.PoolsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPoolPatch{ - // ... -} - - -if err := client.PoolsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/capacitypools/client.go b/resource-manager/netapp/2022-09-01/capacitypools/client.go deleted file mode 100644 index 3de33a3dc5b..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package capacitypools - -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 CapacityPoolsClient struct { - Client *resourcemanager.Client -} - -func NewCapacityPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityPoolsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "capacitypools", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) - } - - return &CapacityPoolsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/constants.go b/resource-manager/netapp/2022-09-01/capacitypools/constants.go deleted file mode 100644 index 802074e5dc1..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/constants.go +++ /dev/null @@ -1,139 +0,0 @@ -package capacitypools - -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 EncryptionType string - -const ( - EncryptionTypeDouble EncryptionType = "Double" - EncryptionTypeSingle EncryptionType = "Single" -) - -func PossibleValuesForEncryptionType() []string { - return []string{ - string(EncryptionTypeDouble), - string(EncryptionTypeSingle), - } -} - -func (s *EncryptionType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionType(input string) (*EncryptionType, error) { - vals := map[string]EncryptionType{ - "double": EncryptionTypeDouble, - "single": EncryptionTypeSingle, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionType(input) - return &out, nil -} - -type QosType string - -const ( - QosTypeAuto QosType = "Auto" - QosTypeManual QosType = "Manual" -) - -func PossibleValuesForQosType() []string { - return []string{ - string(QosTypeAuto), - string(QosTypeManual), - } -} - -func (s *QosType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseQosType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseQosType(input string) (*QosType, error) { - vals := map[string]QosType{ - "auto": QosTypeAuto, - "manual": QosTypeManual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QosType(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go deleted file mode 100644 index 69954702fd9..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool_test.go b/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool_test.go deleted file mode 100644 index a7eaff1ee66..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go deleted file mode 100644 index f424e58a9e8..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount_test.go b/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount_test.go deleted file mode 100644 index 13bb52f3713..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/method_poolscreateorupdate.go b/resource-manager/netapp/2022-09-01/capacitypools/method_poolscreateorupdate.go deleted file mode 100644 index d25b060fccf..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/method_poolscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsCreateOrUpdate ... -func (c CapacityPoolsClient) PoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (result PoolsCreateOrUpdateOperationResponse, 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 -} - -// PoolsCreateOrUpdateThenPoll performs PoolsCreateOrUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsCreateOrUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPool) error { - result, err := c.PoolsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/method_poolsdelete.go b/resource-manager/netapp/2022-09-01/capacitypools/method_poolsdelete.go deleted file mode 100644 index 36c9e0e6bcf..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/method_poolsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package capacitypools - -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 PoolsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsDelete ... -func (c CapacityPoolsClient) PoolsDelete(ctx context.Context, id CapacityPoolId) (result PoolsDeleteOperationResponse, 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 -} - -// PoolsDeleteThenPoll performs PoolsDelete then polls until it's completed -func (c CapacityPoolsClient) PoolsDeleteThenPoll(ctx context.Context, id CapacityPoolId) error { - result, err := c.PoolsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PoolsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/method_poolsget.go b/resource-manager/netapp/2022-09-01/capacitypools/method_poolsget.go deleted file mode 100644 index 26acc6641bb..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/method_poolsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package capacitypools - -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 PoolsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CapacityPool -} - -// PoolsGet ... -func (c CapacityPoolsClient) PoolsGet(ctx context.Context, id CapacityPoolId) (result PoolsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/method_poolslist.go b/resource-manager/netapp/2022-09-01/capacitypools/method_poolslist.go deleted file mode 100644 index 9b29e63dbdb..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/method_poolslist.go +++ /dev/null @@ -1,89 +0,0 @@ -package capacitypools - -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 PoolsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]CapacityPool -} - -type PoolsListCompleteResult struct { - Items []CapacityPool -} - -// PoolsList ... -func (c CapacityPoolsClient) PoolsList(ctx context.Context, id NetAppAccountId) (result PoolsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/capacityPools", 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 *[]CapacityPool `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// PoolsListComplete retrieves all the results into a single object -func (c CapacityPoolsClient) PoolsListComplete(ctx context.Context, id NetAppAccountId) (PoolsListCompleteResult, error) { - return c.PoolsListCompleteMatchingPredicate(ctx, id, CapacityPoolOperationPredicate{}) -} - -// PoolsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c CapacityPoolsClient) PoolsListCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate CapacityPoolOperationPredicate) (result PoolsListCompleteResult, err error) { - items := make([]CapacityPool, 0) - - resp, err := c.PoolsList(ctx, id) - if err != nil { - 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 = PoolsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/method_poolsupdate.go b/resource-manager/netapp/2022-09-01/capacitypools/method_poolsupdate.go deleted file mode 100644 index 7396db6d249..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/method_poolsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsUpdate ... -func (c CapacityPoolsClient) PoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (result PoolsUpdateOperationResponse, 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 -} - -// PoolsUpdateThenPoll performs PoolsUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) error { - result, err := c.PoolsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/model_capacitypool.go b/resource-manager/netapp/2022-09-01/capacitypools/model_capacitypool.go deleted file mode 100644 index f5d6f1ea86d..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/model_capacitypool.go +++ /dev/null @@ -1,19 +0,0 @@ -package capacitypools - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPool struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties PoolProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/model_capacitypoolpatch.go b/resource-manager/netapp/2022-09-01/capacitypools/model_capacitypoolpatch.go deleted file mode 100644 index 46abcde6b33..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/model_capacitypoolpatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PoolPatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/model_poolpatchproperties.go b/resource-manager/netapp/2022-09-01/capacitypools/model_poolpatchproperties.go deleted file mode 100644 index c971dd8637c..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/model_poolpatchproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolPatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/model_poolproperties.go b/resource-manager/netapp/2022-09-01/capacitypools/model_poolproperties.go deleted file mode 100644 index a1fee733fb4..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/model_poolproperties.go +++ /dev/null @@ -1,16 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - EncryptionType *EncryptionType `json:"encryptionType,omitempty"` - PoolId *string `json:"poolId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - ServiceLevel ServiceLevel `json:"serviceLevel"` - Size int64 `json:"size"` - TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` - UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/predicates.go b/resource-manager/netapp/2022-09-01/capacitypools/predicates.go deleted file mode 100644 index 386a7986d42..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p CapacityPoolOperationPredicate) Matches(input CapacityPool) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-09-01/capacitypools/version.go b/resource-manager/netapp/2022-09-01/capacitypools/version.go deleted file mode 100644 index a9e64748523..00000000000 --- a/resource-manager/netapp/2022-09-01/capacitypools/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package capacitypools - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/capacitypools/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/client.go b/resource-manager/netapp/2022-09-01/client.go deleted file mode 100644 index 8b0fd7f800e..00000000000 --- a/resource-manager/netapp/2022-09-01/client.go +++ /dev/null @@ -1,190 +0,0 @@ -package v2022_09_01 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/backuppolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/backups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/capacitypools" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/filelocks" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/netappaccounts" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/netappresource" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/poolchange" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/resetcifspassword" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/restore" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/snapshotpolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/snapshots" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/subvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesrelocation" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesreplication" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesrevert" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" -) - -type Client struct { - BackupPolicy *backuppolicy.BackupPolicyClient - Backups *backups.BackupsClient - CapacityPools *capacitypools.CapacityPoolsClient - FileLocks *filelocks.FileLocksClient - NetAppAccounts *netappaccounts.NetAppAccountsClient - NetAppResource *netappresource.NetAppResourceClient - PoolChange *poolchange.PoolChangeClient - ResetCifsPassword *resetcifspassword.ResetCifsPasswordClient - Restore *restore.RestoreClient - SnapshotPolicy *snapshotpolicy.SnapshotPolicyClient - SnapshotPolicyListVolumes *snapshotpolicylistvolumes.SnapshotPolicyListVolumesClient - Snapshots *snapshots.SnapshotsClient - SubVolumes *subvolumes.SubVolumesClient - VolumeGroups *volumegroups.VolumeGroupsClient - VolumeQuotaRules *volumequotarules.VolumeQuotaRulesClient - Volumes *volumes.VolumesClient - VolumesRelocation *volumesrelocation.VolumesRelocationClient - VolumesReplication *volumesreplication.VolumesReplicationClient - VolumesRevert *volumesrevert.VolumesRevertClient -} - -func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { - backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building BackupPolicy client: %+v", err) - } - configureFunc(backupPolicyClient.Client) - - backupsClient, err := backups.NewBackupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Backups client: %+v", err) - } - configureFunc(backupsClient.Client) - - capacityPoolsClient, err := capacitypools.NewCapacityPoolsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building CapacityPools client: %+v", err) - } - configureFunc(capacityPoolsClient.Client) - - fileLocksClient, err := filelocks.NewFileLocksClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building FileLocks client: %+v", err) - } - configureFunc(fileLocksClient.Client) - - netAppAccountsClient, err := netappaccounts.NewNetAppAccountsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppAccounts client: %+v", err) - } - configureFunc(netAppAccountsClient.Client) - - netAppResourceClient, err := netappresource.NewNetAppResourceClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppResource client: %+v", err) - } - configureFunc(netAppResourceClient.Client) - - poolChangeClient, err := poolchange.NewPoolChangeClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building PoolChange client: %+v", err) - } - configureFunc(poolChangeClient.Client) - - resetCifsPasswordClient, err := resetcifspassword.NewResetCifsPasswordClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building ResetCifsPassword client: %+v", err) - } - configureFunc(resetCifsPasswordClient.Client) - - restoreClient, err := restore.NewRestoreClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Restore client: %+v", err) - } - configureFunc(restoreClient.Client) - - snapshotPolicyClient, err := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicy client: %+v", err) - } - configureFunc(snapshotPolicyClient.Client) - - snapshotPolicyListVolumesClient, err := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicyListVolumes client: %+v", err) - } - configureFunc(snapshotPolicyListVolumesClient.Client) - - snapshotsClient, err := snapshots.NewSnapshotsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Snapshots client: %+v", err) - } - configureFunc(snapshotsClient.Client) - - subVolumesClient, err := subvolumes.NewSubVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SubVolumes client: %+v", err) - } - configureFunc(subVolumesClient.Client) - - volumeGroupsClient, err := volumegroups.NewVolumeGroupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeGroups client: %+v", err) - } - configureFunc(volumeGroupsClient.Client) - - volumeQuotaRulesClient, err := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeQuotaRules client: %+v", err) - } - configureFunc(volumeQuotaRulesClient.Client) - - volumesClient, err := volumes.NewVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Volumes client: %+v", err) - } - configureFunc(volumesClient.Client) - - volumesRelocationClient, err := volumesrelocation.NewVolumesRelocationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRelocation client: %+v", err) - } - configureFunc(volumesRelocationClient.Client) - - volumesReplicationClient, err := volumesreplication.NewVolumesReplicationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesReplication client: %+v", err) - } - configureFunc(volumesReplicationClient.Client) - - volumesRevertClient, err := volumesrevert.NewVolumesRevertClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRevert client: %+v", err) - } - configureFunc(volumesRevertClient.Client) - - return &Client{ - BackupPolicy: backupPolicyClient, - Backups: backupsClient, - CapacityPools: capacityPoolsClient, - FileLocks: fileLocksClient, - NetAppAccounts: netAppAccountsClient, - NetAppResource: netAppResourceClient, - PoolChange: poolChangeClient, - ResetCifsPassword: resetCifsPasswordClient, - Restore: restoreClient, - SnapshotPolicy: snapshotPolicyClient, - SnapshotPolicyListVolumes: snapshotPolicyListVolumesClient, - Snapshots: snapshotsClient, - SubVolumes: subVolumesClient, - VolumeGroups: volumeGroupsClient, - VolumeQuotaRules: volumeQuotaRulesClient, - Volumes: volumesClient, - VolumesRelocation: volumesRelocationClient, - VolumesReplication: volumesReplicationClient, - VolumesRevert: volumesRevertClient, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/filelocks/README.md b/resource-manager/netapp/2022-09-01/filelocks/README.md deleted file mode 100644 index 0806d19a8e5..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/filelocks` Documentation - -The `filelocks` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/filelocks" -``` - - -### Client Initialization - -```go -client := filelocks.NewFileLocksClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `FileLocksClient.VolumesBreakFileLocks` - -```go -ctx := context.TODO() -id := filelocks.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := filelocks.BreakFileLocksRequest{ - // ... -} - - -if err := client.VolumesBreakFileLocksThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/filelocks/client.go b/resource-manager/netapp/2022-09-01/filelocks/client.go deleted file mode 100644 index 7f39f5ef46b..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package filelocks - -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 FileLocksClient struct { - Client *resourcemanager.Client -} - -func NewFileLocksClientWithBaseURI(sdkApi sdkEnv.Api) (*FileLocksClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "filelocks", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating FileLocksClient: %+v", err) - } - - return &FileLocksClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/filelocks/id_volume.go b/resource-manager/netapp/2022-09-01/filelocks/id_volume.go deleted file mode 100644 index 446434f9140..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package filelocks - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/filelocks/id_volume_test.go b/resource-manager/netapp/2022-09-01/filelocks/id_volume_test.go deleted file mode 100644 index ba5d9fabf43..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package filelocks - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/filelocks/method_volumesbreakfilelocks.go b/resource-manager/netapp/2022-09-01/filelocks/method_volumesbreakfilelocks.go deleted file mode 100644 index c1ff2b4b86f..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/method_volumesbreakfilelocks.go +++ /dev/null @@ -1,74 +0,0 @@ -package filelocks - -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 VolumesBreakFileLocksOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakFileLocks ... -func (c FileLocksClient) VolumesBreakFileLocks(ctx context.Context, id VolumeId, input BreakFileLocksRequest) (result VolumesBreakFileLocksOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakFileLocks", 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 -} - -// VolumesBreakFileLocksThenPoll performs VolumesBreakFileLocks then polls until it's completed -func (c FileLocksClient) VolumesBreakFileLocksThenPoll(ctx context.Context, id VolumeId, input BreakFileLocksRequest) error { - result, err := c.VolumesBreakFileLocks(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakFileLocks: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakFileLocks: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/filelocks/model_breakfilelocksrequest.go b/resource-manager/netapp/2022-09-01/filelocks/model_breakfilelocksrequest.go deleted file mode 100644 index 62fa9fc9808..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/model_breakfilelocksrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package filelocks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakFileLocksRequest struct { - ClientIP *string `json:"clientIp,omitempty"` - ConfirmRunningDisruptiveOperation *bool `json:"confirmRunningDisruptiveOperation,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/filelocks/version.go b/resource-manager/netapp/2022-09-01/filelocks/version.go deleted file mode 100644 index 15f6e69145b..00000000000 --- a/resource-manager/netapp/2022-09-01/filelocks/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package filelocks - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/filelocks/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/README.md b/resource-manager/netapp/2022-09-01/netappaccounts/README.md deleted file mode 100644 index 6e36c7bdedf..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/README.md +++ /dev/null @@ -1,128 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/netappaccounts` Documentation - -The `netappaccounts` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/netappaccounts" -``` - - -### Client Initialization - -```go -client := netappaccounts.NewNetAppAccountsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppAccountsClient.AccountsCreateOrUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccount{ - // ... -} - - -if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsDelete` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsGet` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsList` - -```go -ctx := context.TODO() -id := netappaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsListBySubscription` - -```go -ctx := context.TODO() -id := netappaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.AccountsListBySubscription(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListBySubscriptionComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsRenewCredentials` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsRenewCredentialsThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccountPatch{ - // ... -} - - -if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/client.go b/resource-manager/netapp/2022-09-01/netappaccounts/client.go deleted file mode 100644 index 172f1218e2c..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappaccounts - -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 NetAppAccountsClient struct { - Client *resourcemanager.Client -} - -func NewNetAppAccountsClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppAccountsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappaccounts", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) - } - - return &NetAppAccountsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/constants.go b/resource-manager/netapp/2022-09-01/netappaccounts/constants.go deleted file mode 100644 index f8d0489c2a0..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/constants.go +++ /dev/null @@ -1,151 +0,0 @@ -package netappaccounts - -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 ActiveDirectoryStatus string - -const ( - ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" - ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" - ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" - ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" - ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" -) - -func PossibleValuesForActiveDirectoryStatus() []string { - return []string{ - string(ActiveDirectoryStatusCreated), - string(ActiveDirectoryStatusDeleted), - string(ActiveDirectoryStatusError), - string(ActiveDirectoryStatusInUse), - string(ActiveDirectoryStatusUpdating), - } -} - -func (s *ActiveDirectoryStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseActiveDirectoryStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseActiveDirectoryStatus(input string) (*ActiveDirectoryStatus, error) { - vals := map[string]ActiveDirectoryStatus{ - "created": ActiveDirectoryStatusCreated, - "deleted": ActiveDirectoryStatusDeleted, - "error": ActiveDirectoryStatusError, - "inuse": ActiveDirectoryStatusInUse, - "updating": ActiveDirectoryStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ActiveDirectoryStatus(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" - KeySourceMicrosoftPointNetApp KeySource = "Microsoft.NetApp" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceMicrosoftPointKeyVault), - string(KeySourceMicrosoftPointNetApp), - } -} - -func (s *KeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, - "microsoft.netapp": KeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type KeyVaultStatus string - -const ( - KeyVaultStatusCreated KeyVaultStatus = "Created" - KeyVaultStatusDeleted KeyVaultStatus = "Deleted" - KeyVaultStatusError KeyVaultStatus = "Error" - KeyVaultStatusInUse KeyVaultStatus = "InUse" - KeyVaultStatusUpdating KeyVaultStatus = "Updating" -) - -func PossibleValuesForKeyVaultStatus() []string { - return []string{ - string(KeyVaultStatusCreated), - string(KeyVaultStatusDeleted), - string(KeyVaultStatusError), - string(KeyVaultStatusInUse), - string(KeyVaultStatusUpdating), - } -} - -func (s *KeyVaultStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeyVaultStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeyVaultStatus(input string) (*KeyVaultStatus, error) { - vals := map[string]KeyVaultStatus{ - "created": KeyVaultStatusCreated, - "deleted": KeyVaultStatusDeleted, - "error": KeyVaultStatusError, - "inuse": KeyVaultStatusInUse, - "updating": KeyVaultStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyVaultStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go deleted file mode 100644 index 07a8ef7a579..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappaccounts - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount_test.go b/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount_test.go deleted file mode 100644 index 0e58b3e4d97..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappaccounts - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountscreateorupdate.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountscreateorupdate.go deleted file mode 100644 index 7d7c0d2ca88..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsCreateOrUpdate ... -func (c NetAppAccountsClient) AccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (result AccountsCreateOrUpdateOperationResponse, 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 -} - -// AccountsCreateOrUpdateThenPoll performs AccountsCreateOrUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsCreateOrUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccount) error { - result, err := c.AccountsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsdelete.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsdelete.go deleted file mode 100644 index ae46b7b061d..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsDelete ... -func (c NetAppAccountsClient) AccountsDelete(ctx context.Context, id NetAppAccountId) (result AccountsDeleteOperationResponse, 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 -} - -// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed -func (c NetAppAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsget.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsget.go deleted file mode 100644 index 4cc63a91e9f..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappaccounts - -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 AccountsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *NetAppAccount -} - -// AccountsGet ... -func (c NetAppAccountsClient) AccountsGet(ctx context.Context, id NetAppAccountId) (result AccountsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountslist.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountslist.go deleted file mode 100644 index 3f16fbcc847..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountslist.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListCompleteResult struct { - Items []NetAppAccount -} - -// AccountsList ... -func (c NetAppAccountsClient) AccountsList(ctx context.Context, id commonids.ResourceGroupId) (result AccountsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListCompleteResult, error) { - return c.AccountsListCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetAppAccountOperationPredicate) (result AccountsListCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsList(ctx, id) - if err != nil { - 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 = AccountsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountslistbysubscription.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountslistbysubscription.go deleted file mode 100644 index 0b66b7c904a..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountslistbysubscription.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListBySubscriptionCompleteResult struct { - Items []NetAppAccount -} - -// AccountsListBySubscription ... -func (c NetAppAccountsClient) AccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result AccountsListBySubscriptionOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListBySubscriptionComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListBySubscriptionCompleteResult, error) { - return c.AccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetAppAccountOperationPredicate) (result AccountsListBySubscriptionCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsListBySubscription(ctx, id) - if err != nil { - 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 = AccountsListBySubscriptionCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsrenewcredentials.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsrenewcredentials.go deleted file mode 100644 index 4d7aca0b151..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsrenewcredentials.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsRenewCredentialsOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsRenewCredentials ... -func (c NetAppAccountsClient) AccountsRenewCredentials(ctx context.Context, id NetAppAccountId) (result AccountsRenewCredentialsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/renewCredentials", 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 -} - -// AccountsRenewCredentialsThenPoll performs AccountsRenewCredentials then polls until it's completed -func (c NetAppAccountsClient) AccountsRenewCredentialsThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsRenewCredentials(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsRenewCredentials: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsRenewCredentials: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsupdate.go b/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsupdate.go deleted file mode 100644 index 14d063ae23d..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/method_accountsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsUpdate ... -func (c NetAppAccountsClient) AccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (result AccountsUpdateOperationResponse, 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 -} - -// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) error { - result, err := c.AccountsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_accountencryption.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_accountencryption.go deleted file mode 100644 index 93f1a662f77..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_accountencryption.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryption struct { - Identity *EncryptionIdentity `json:"identity,omitempty"` - KeySource *KeySource `json:"keySource,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_accountproperties.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_accountproperties.go deleted file mode 100644 index 18428908f56..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_accountproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountProperties struct { - ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` - DisableShowmount *bool `json:"disableShowmount,omitempty"` - Encryption *AccountEncryption `json:"encryption,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_activedirectory.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_activedirectory.go deleted file mode 100644 index 81bbf0d2927..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_activedirectory.go +++ /dev/null @@ -1,30 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ActiveDirectory struct { - ActiveDirectoryId *string `json:"activeDirectoryId,omitempty"` - AdName *string `json:"adName,omitempty"` - Administrators *[]string `json:"administrators,omitempty"` - AesEncryption *bool `json:"aesEncryption,omitempty"` - AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` - BackupOperators *[]string `json:"backupOperators,omitempty"` - Dns *string `json:"dns,omitempty"` - Domain *string `json:"domain,omitempty"` - EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` - KdcIP *string `json:"kdcIP,omitempty"` - LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` - LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` - LdapSigning *bool `json:"ldapSigning,omitempty"` - OrganizationalUnit *string `json:"organizationalUnit,omitempty"` - Password *string `json:"password,omitempty"` - PreferredServersForLdapClient *string `json:"preferredServersForLdapClient,omitempty"` - SecurityOperators *[]string `json:"securityOperators,omitempty"` - ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` - Site *string `json:"site,omitempty"` - SmbServerName *string `json:"smbServerName,omitempty"` - Status *ActiveDirectoryStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - Username *string `json:"username,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_encryptionidentity.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_encryptionidentity.go deleted file mode 100644 index 50cf4dbf679..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_encryptionidentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncryptionIdentity struct { - PrincipalId *string `json:"principalId,omitempty"` - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_keyvaultproperties.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_keyvaultproperties.go deleted file mode 100644 index ac5d8c6afa4..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_keyvaultproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KeyVaultProperties struct { - KeyName string `json:"keyName"` - KeyVaultId *string `json:"keyVaultId,omitempty"` - KeyVaultResourceId string `json:"keyVaultResourceId"` - KeyVaultUri string `json:"keyVaultUri"` - Status *KeyVaultStatus `json:"status,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_ldapsearchscopeopt.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_ldapsearchscopeopt.go deleted file mode 100644 index c476b0f0875..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_ldapsearchscopeopt.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LdapSearchScopeOpt struct { - GroupDN *string `json:"groupDN,omitempty"` - GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` - UserDN *string `json:"userDN,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccount.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccount.go deleted file mode 100644 index ae38663e126..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccount.go +++ /dev/null @@ -1,21 +0,0 @@ -package netappaccounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccount struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccountpatch.go b/resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccountpatch.go deleted file mode 100644 index d3c6c1efcc2..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/model_netappaccountpatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/predicates.go b/resource-manager/netapp/2022-09-01/netappaccounts/predicates.go deleted file mode 100644 index ad2c0a55483..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p NetAppAccountOperationPredicate) Matches(input NetAppAccount) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-09-01/netappaccounts/version.go b/resource-manager/netapp/2022-09-01/netappaccounts/version.go deleted file mode 100644 index 0a3e54bbab8..00000000000 --- a/resource-manager/netapp/2022-09-01/netappaccounts/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappaccounts/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/README.md b/resource-manager/netapp/2022-09-01/netappresource/README.md deleted file mode 100644 index 2bf2fddce68..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/README.md +++ /dev/null @@ -1,131 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/netappresource` Documentation - -The `netappresource` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/netappresource" -``` - - -### Client Initialization - -```go -client := netappresource.NewNetAppResourceClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppResourceClient.CheckFilePathAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.FilePathAvailabilityRequest{ - // ... -} - - -read, err := client.CheckFilePathAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckNameAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.ResourceNameAvailabilityRequest{ - // ... -} - - -read, err := client.CheckNameAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckQuotaAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.QuotaAvailabilityRequest{ - // ... -} - - -read, err := client.CheckQuotaAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QueryRegionInfo` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QueryRegionInfo(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsGet` - -```go -ctx := context.TODO() -id := netappresource.NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - -read, err := client.QuotaLimitsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsList` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QuotaLimitsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-09-01/netappresource/client.go b/resource-manager/netapp/2022-09-01/netappresource/client.go deleted file mode 100644 index e02988617d8..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappresource - -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 NetAppResourceClient struct { - Client *resourcemanager.Client -} - -func NewNetAppResourceClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppResourceClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappresource", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) - } - - return &NetAppResourceClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/constants.go b/resource-manager/netapp/2022-09-01/netappresource/constants.go deleted file mode 100644 index a4510b72228..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/constants.go +++ /dev/null @@ -1,192 +0,0 @@ -package netappresource - -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 CheckNameResourceTypes string - -const ( - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckNameResourceTypes() []string { - return []string{ - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckNameResourceTypes(input string) (*CheckNameResourceTypes, error) { - vals := map[string]CheckNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckNameResourceTypes(input) - return &out, nil -} - -type CheckQuotaNameResourceTypes string - -const ( - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckQuotaNameResourceTypes() []string { - return []string{ - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckQuotaNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckQuotaNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckQuotaNameResourceTypes(input string) (*CheckQuotaNameResourceTypes, error) { - vals := map[string]CheckQuotaNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckQuotaNameResourceTypes(input) - return &out, nil -} - -type InAvailabilityReasonType string - -const ( - InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" - InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" -) - -func PossibleValuesForInAvailabilityReasonType() []string { - return []string{ - string(InAvailabilityReasonTypeAlreadyExists), - string(InAvailabilityReasonTypeInvalid), - } -} - -func (s *InAvailabilityReasonType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseInAvailabilityReasonType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseInAvailabilityReasonType(input string) (*InAvailabilityReasonType, error) { - vals := map[string]InAvailabilityReasonType{ - "alreadyexists": InAvailabilityReasonTypeAlreadyExists, - "invalid": InAvailabilityReasonTypeInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InAvailabilityReasonType(input) - return &out, nil -} - -type RegionStorageToNetworkProximity string - -const ( - RegionStorageToNetworkProximityDefault RegionStorageToNetworkProximity = "Default" - RegionStorageToNetworkProximityTOne RegionStorageToNetworkProximity = "T1" - RegionStorageToNetworkProximityTOneAndTTwo RegionStorageToNetworkProximity = "T1AndT2" - RegionStorageToNetworkProximityTTwo RegionStorageToNetworkProximity = "T2" -) - -func PossibleValuesForRegionStorageToNetworkProximity() []string { - return []string{ - string(RegionStorageToNetworkProximityDefault), - string(RegionStorageToNetworkProximityTOne), - string(RegionStorageToNetworkProximityTOneAndTTwo), - string(RegionStorageToNetworkProximityTTwo), - } -} - -func (s *RegionStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRegionStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRegionStorageToNetworkProximity(input string) (*RegionStorageToNetworkProximity, error) { - vals := map[string]RegionStorageToNetworkProximity{ - "default": RegionStorageToNetworkProximityDefault, - "t1": RegionStorageToNetworkProximityTOne, - "t1andt2": RegionStorageToNetworkProximityTOneAndTTwo, - "t2": RegionStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RegionStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/id_location.go b/resource-manager/netapp/2022-09-01/netappresource/id_location.go deleted file mode 100644 index 7c120e2a191..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/id_location.go +++ /dev/null @@ -1,116 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - LocationName string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, locationName string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - return nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(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 := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/id_location_test.go b/resource-manager/netapp/2022-09-01/netappresource/id_location_test.go deleted file mode 100644 index 37beb10bbc3..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/id_location_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -func TestNewLocationID(t *testing.T) { - id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } -} - -func TestFormatLocationID(t *testing.T) { - actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseLocationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestParseLocationIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestSegmentsForLocationId(t *testing.T) { - segments := LocationId{}.Segments() - if len(segments) == 0 { - t.Fatalf("LocationId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go deleted file mode 100644 index aa29f073d5d..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -// QuotaLimitId is a struct representing the Resource ID for a Quota Limit -type QuotaLimitId struct { - SubscriptionId string - LocationName string - QuotaLimitName string -} - -// NewQuotaLimitID returns a new QuotaLimitId struct -func NewQuotaLimitID(subscriptionId string, locationName string, quotaLimitName string) QuotaLimitId { - return QuotaLimitId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - QuotaLimitName: quotaLimitName, - } -} - -// ParseQuotaLimitID parses 'input' into a QuotaLimitId -func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseQuotaLimitIDInsensitively parses 'input' case-insensitively into a QuotaLimitId -// note: this method should only be used for API response data and not user input -func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) - } - - return nil -} - -// ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID -func ValidateQuotaLimitID(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 := ParseQuotaLimitID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Quota Limit ID -func (id QuotaLimitId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s/quotaLimits/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.QuotaLimitName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Quota Limit ID -func (id QuotaLimitId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - resourceids.StaticSegment("staticQuotaLimits", "quotaLimits", "quotaLimits"), - resourceids.UserSpecifiedSegment("quotaLimitName", "quotaLimitValue"), - } -} - -// String returns a human-readable description of this Quota Limit ID -func (id QuotaLimitId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - fmt.Sprintf("Quota Limit Name: %q", id.QuotaLimitName), - } - return fmt.Sprintf("Quota Limit (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit_test.go b/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit_test.go deleted file mode 100644 index ca3050d8d70..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/id_quotalimit_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -func TestNewQuotaLimitID(t *testing.T) { - id := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } - - if id.QuotaLimitName != "quotaLimitValue" { - t.Fatalf("Expected %q but got %q for Segment 'QuotaLimitName'", id.QuotaLimitName, "quotaLimitValue") - } -} - -func TestFormatQuotaLimitID(t *testing.T) { - actual := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseQuotaLimitID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestParseQuotaLimitIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - QuotaLimitName: "qUoTaLiMiTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestSegmentsForQuotaLimitId(t *testing.T) { - segments := QuotaLimitId{}.Segments() - if len(segments) == 0 { - t.Fatalf("QuotaLimitId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/method_checkfilepathavailability.go b/resource-manager/netapp/2022-09-01/netappresource/method_checkfilepathavailability.go deleted file mode 100644 index ccaafd95a81..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/method_checkfilepathavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckFilePathAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckFilePathAvailability ... -func (c NetAppResourceClient) CheckFilePathAvailability(ctx context.Context, id LocationId, input FilePathAvailabilityRequest) (result CheckFilePathAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkFilePathAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/method_checknameavailability.go b/resource-manager/netapp/2022-09-01/netappresource/method_checknameavailability.go deleted file mode 100644 index 277efaba606..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/method_checknameavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckNameAvailability ... -func (c NetAppResourceClient) CheckNameAvailability(ctx context.Context, id LocationId, input ResourceNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkNameAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/method_checkquotaavailability.go b/resource-manager/netapp/2022-09-01/netappresource/method_checkquotaavailability.go deleted file mode 100644 index e332f8c761b..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/method_checkquotaavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckQuotaAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckQuotaAvailability ... -func (c NetAppResourceClient) CheckQuotaAvailability(ctx context.Context, id LocationId, input QuotaAvailabilityRequest) (result CheckQuotaAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkQuotaAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/method_queryregioninfo.go b/resource-manager/netapp/2022-09-01/netappresource/method_queryregioninfo.go deleted file mode 100644 index bce1ced7640..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/method_queryregioninfo.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QueryRegionInfoOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RegionInfo -} - -// QueryRegionInfo ... -func (c NetAppResourceClient) QueryRegionInfo(ctx context.Context, id LocationId) (result QueryRegionInfoOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/regionInfo", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/method_quotalimitsget.go b/resource-manager/netapp/2022-09-01/netappresource/method_quotalimitsget.go deleted file mode 100644 index 2b566bfa762..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/method_quotalimitsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappresource - -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 QuotaLimitsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItem -} - -// QuotaLimitsGet ... -func (c NetAppResourceClient) QuotaLimitsGet(ctx context.Context, id QuotaLimitId) (result QuotaLimitsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/method_quotalimitslist.go b/resource-manager/netapp/2022-09-01/netappresource/method_quotalimitslist.go deleted file mode 100644 index e7dcec4cc4e..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/method_quotalimitslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QuotaLimitsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItemList -} - -// QuotaLimitsList ... -func (c NetAppResourceClient) QuotaLimitsList(ctx context.Context, id LocationId) (result QuotaLimitsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/quotaLimits", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_checkavailabilityresponse.go b/resource-manager/netapp/2022-09-01/netappresource/model_checkavailabilityresponse.go deleted file mode 100644 index 6423d9de076..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_checkavailabilityresponse.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckAvailabilityResponse struct { - IsAvailable *bool `json:"isAvailable,omitempty"` - Message *string `json:"message,omitempty"` - Reason *InAvailabilityReasonType `json:"reason,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_filepathavailabilityrequest.go b/resource-manager/netapp/2022-09-01/netappresource/model_filepathavailabilityrequest.go deleted file mode 100644 index 6407d29060b..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_filepathavailabilityrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilePathAvailabilityRequest struct { - Name string `json:"name"` - SubnetId string `json:"subnetId"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_quotaavailabilityrequest.go b/resource-manager/netapp/2022-09-01/netappresource/model_quotaavailabilityrequest.go deleted file mode 100644 index d8df9ac4cef..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_quotaavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type QuotaAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckQuotaNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_regioninfo.go b/resource-manager/netapp/2022-09-01/netappresource/model_regioninfo.go deleted file mode 100644 index 63c92a72c98..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_regioninfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfo struct { - AvailabilityZoneMappings *[]RegionInfoAvailabilityZoneMappingsInlined `json:"availabilityZoneMappings,omitempty"` - StorageToNetworkProximity *RegionStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go b/resource-manager/netapp/2022-09-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go deleted file mode 100644 index 36fce7489dc..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfoAvailabilityZoneMappingsInlined struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - IsAvailable *bool `json:"isAvailable,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_resourcenameavailabilityrequest.go b/resource-manager/netapp/2022-09-01/netappresource/model_resourcenameavailabilityrequest.go deleted file mode 100644 index 0bfbaf4c0e9..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_resourcenameavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ResourceNameAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitem.go b/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitem.go deleted file mode 100644 index 88a5cbd39c1..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitem.go +++ /dev/null @@ -1,16 +0,0 @@ -package netappresource - -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 SubscriptionQuotaItem struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubscriptionQuotaItemProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemlist.go b/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemlist.go deleted file mode 100644 index 800319869a1..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemlist.go +++ /dev/null @@ -1,8 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemList struct { - Value *[]SubscriptionQuotaItem `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemproperties.go b/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemproperties.go deleted file mode 100644 index 01cdd538c05..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/model_subscriptionquotaitemproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemProperties struct { - Current *int64 `json:"current,omitempty"` - Default *int64 `json:"default,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/netappresource/version.go b/resource-manager/netapp/2022-09-01/netappresource/version.go deleted file mode 100644 index 37e4f29cf96..00000000000 --- a/resource-manager/netapp/2022-09-01/netappresource/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappresource - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappresource/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/poolchange/README.md b/resource-manager/netapp/2022-09-01/poolchange/README.md deleted file mode 100644 index 1b014aaa6a6..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/poolchange` Documentation - -The `poolchange` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/poolchange" -``` - - -### Client Initialization - -```go -client := poolchange.NewPoolChangeClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `PoolChangeClient.VolumesPoolChange` - -```go -ctx := context.TODO() -id := poolchange.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := poolchange.PoolChangeRequest{ - // ... -} - - -if err := client.VolumesPoolChangeThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/poolchange/client.go b/resource-manager/netapp/2022-09-01/poolchange/client.go deleted file mode 100644 index 270c25028c2..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package poolchange - -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 PoolChangeClient struct { - Client *resourcemanager.Client -} - -func NewPoolChangeClientWithBaseURI(sdkApi sdkEnv.Api) (*PoolChangeClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "poolchange", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) - } - - return &PoolChangeClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/poolchange/id_volume.go b/resource-manager/netapp/2022-09-01/poolchange/id_volume.go deleted file mode 100644 index 60065ac10ae..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package poolchange - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/poolchange/id_volume_test.go b/resource-manager/netapp/2022-09-01/poolchange/id_volume_test.go deleted file mode 100644 index 496e8bbcaad..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package poolchange - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/poolchange/method_volumespoolchange.go b/resource-manager/netapp/2022-09-01/poolchange/method_volumespoolchange.go deleted file mode 100644 index 7a0ca0e6450..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/method_volumespoolchange.go +++ /dev/null @@ -1,74 +0,0 @@ -package poolchange - -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 VolumesPoolChangeOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesPoolChange ... -func (c PoolChangeClient) VolumesPoolChange(ctx context.Context, id VolumeId, input PoolChangeRequest) (result VolumesPoolChangeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/poolChange", 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 -} - -// VolumesPoolChangeThenPoll performs VolumesPoolChange then polls until it's completed -func (c PoolChangeClient) VolumesPoolChangeThenPoll(ctx context.Context, id VolumeId, input PoolChangeRequest) error { - result, err := c.VolumesPoolChange(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesPoolChange: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesPoolChange: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/poolchange/model_poolchangerequest.go b/resource-manager/netapp/2022-09-01/poolchange/model_poolchangerequest.go deleted file mode 100644 index 19402a5b699..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/model_poolchangerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package poolchange - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolChangeRequest struct { - NewPoolResourceId string `json:"newPoolResourceId"` -} diff --git a/resource-manager/netapp/2022-09-01/poolchange/version.go b/resource-manager/netapp/2022-09-01/poolchange/version.go deleted file mode 100644 index 688bc455545..00000000000 --- a/resource-manager/netapp/2022-09-01/poolchange/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package poolchange - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/poolchange/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/resetcifspassword/client.go b/resource-manager/netapp/2022-09-01/resetcifspassword/client.go deleted file mode 100644 index 2d17ccc3976..00000000000 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package resetcifspassword - -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 ResetCifsPasswordClient struct { - Client *resourcemanager.Client -} - -func NewResetCifsPasswordClientWithBaseURI(sdkApi sdkEnv.Api) (*ResetCifsPasswordClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "resetcifspassword", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) - } - - return &ResetCifsPasswordClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go deleted file mode 100644 index 69421cfe5d9..00000000000 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package resetcifspassword - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume_test.go b/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume_test.go deleted file mode 100644 index 9b41608cce7..00000000000 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package resetcifspassword - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/resetcifspassword/method_volumesresetcifspassword.go b/resource-manager/netapp/2022-09-01/resetcifspassword/method_volumesresetcifspassword.go deleted file mode 100644 index ca6d379fdfc..00000000000 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/method_volumesresetcifspassword.go +++ /dev/null @@ -1,70 +0,0 @@ -package resetcifspassword - -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 VolumesResetCifsPasswordOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResetCifsPassword ... -func (c ResetCifsPasswordClient) VolumesResetCifsPassword(ctx context.Context, id VolumeId) (result VolumesResetCifsPasswordOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resetCifsPassword", 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 -} - -// VolumesResetCifsPasswordThenPoll performs VolumesResetCifsPassword then polls until it's completed -func (c ResetCifsPasswordClient) VolumesResetCifsPasswordThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResetCifsPassword(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResetCifsPassword: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResetCifsPassword: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/resetcifspassword/version.go b/resource-manager/netapp/2022-09-01/resetcifspassword/version.go deleted file mode 100644 index ce533b951dd..00000000000 --- a/resource-manager/netapp/2022-09-01/resetcifspassword/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package resetcifspassword - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/resetcifspassword/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/restore/README.md b/resource-manager/netapp/2022-09-01/restore/README.md deleted file mode 100644 index 5681589a6c4..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/restore` Documentation - -The `restore` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/restore" -``` - - -### Client Initialization - -```go -client := restore.NewRestoreClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `RestoreClient.BackupsGetVolumeRestoreStatus` - -```go -ctx := context.TODO() -id := restore.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.BackupsGetVolumeRestoreStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-09-01/restore/client.go b/resource-manager/netapp/2022-09-01/restore/client.go deleted file mode 100644 index 97fa355d7db..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package restore - -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 RestoreClient struct { - Client *resourcemanager.Client -} - -func NewRestoreClientWithBaseURI(sdkApi sdkEnv.Api) (*RestoreClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "restore", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) - } - - return &RestoreClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/restore/constants.go b/resource-manager/netapp/2022-09-01/restore/constants.go deleted file mode 100644 index 9eea259cd41..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/constants.go +++ /dev/null @@ -1,95 +0,0 @@ -package restore - -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 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/restore/id_volume.go b/resource-manager/netapp/2022-09-01/restore/id_volume.go deleted file mode 100644 index 46089747e17..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package restore - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/restore/id_volume_test.go b/resource-manager/netapp/2022-09-01/restore/id_volume_test.go deleted file mode 100644 index 2f07b6ef48e..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package restore - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/restore/method_backupsgetvolumerestorestatus.go b/resource-manager/netapp/2022-09-01/restore/method_backupsgetvolumerestorestatus.go deleted file mode 100644 index 47f85cfa0ce..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/method_backupsgetvolumerestorestatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package restore - -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 BackupsGetVolumeRestoreStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RestoreStatus -} - -// BackupsGetVolumeRestoreStatus ... -func (c RestoreClient) BackupsGetVolumeRestoreStatus(ctx context.Context, id VolumeId) (result BackupsGetVolumeRestoreStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/restoreStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/restore/model_restorestatus.go b/resource-manager/netapp/2022-09-01/restore/model_restorestatus.go deleted file mode 100644 index 546d31e9ce7..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/model_restorestatus.go +++ /dev/null @@ -1,13 +0,0 @@ -package restore - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/restore/version.go b/resource-manager/netapp/2022-09-01/restore/version.go deleted file mode 100644 index 74ce9cfd962..00000000000 --- a/resource-manager/netapp/2022-09-01/restore/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package restore - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/restore/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/README.md b/resource-manager/netapp/2022-09-01/snapshotpolicy/README.md deleted file mode 100644 index 13d1ccaef0c..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/README.md +++ /dev/null @@ -1,102 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/snapshotpolicy` Documentation - -The `snapshotpolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/snapshotpolicy" -``` - - -### Client Initialization - -```go -client := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesCreate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicy{ - // ... -} - - -read, err := client.SnapshotPoliciesCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesDelete` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesGet` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesList` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.SnapshotPoliciesList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesUpdate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicyPatch{ - // ... -} - - -if err := client.SnapshotPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go deleted file mode 100644 index eebb8c7b8da..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicy - -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 SnapshotPolicyClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) - } - - return &SnapshotPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go deleted file mode 100644 index 162b7094379..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount_test.go deleted file mode 100644 index c181f6cd7cd..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go deleted file mode 100644 index 3daea71a654..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy_test.go deleted file mode 100644 index b3f070cc0f2..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciescreate.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciescreate.go deleted file mode 100644 index 8a1724f9e0d..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciescreate.go +++ /dev/null @@ -1,56 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesCreateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesCreate ... -func (c SnapshotPolicyClient) SnapshotPoliciesCreate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicy) (result SnapshotPoliciesCreateOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesdelete.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesdelete.go deleted file mode 100644 index 88822a15bf8..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesDelete ... -func (c SnapshotPolicyClient) SnapshotPoliciesDelete(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesDeleteOperationResponse, 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 -} - -// SnapshotPoliciesDeleteThenPoll performs SnapshotPoliciesDelete then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesDeleteThenPoll(ctx context.Context, id SnapshotPolicyId) error { - result, err := c.SnapshotPoliciesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesget.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesget.go deleted file mode 100644 index ebb812f1ffb..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesGet ... -func (c SnapshotPolicyClient) SnapshotPoliciesGet(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpolicieslist.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpolicieslist.go deleted file mode 100644 index bec4c8146b3..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPoliciesList -} - -// SnapshotPoliciesList ... -func (c SnapshotPolicyClient) SnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (result SnapshotPoliciesListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshotPolicies", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesupdate.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesupdate.go deleted file mode 100644 index 46bf5bd6f56..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/method_snapshotpoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesUpdate ... -func (c SnapshotPolicyClient) SnapshotPoliciesUpdate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) (result SnapshotPoliciesUpdateOperationResponse, 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 -} - -// SnapshotPoliciesUpdateThenPoll performs SnapshotPoliciesUpdate then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesUpdateThenPoll(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) error { - result, err := c.SnapshotPoliciesUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_dailyschedule.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_dailyschedule.go deleted file mode 100644 index bdafb72e6e0..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_dailyschedule.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DailySchedule struct { - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_hourlyschedule.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_hourlyschedule.go deleted file mode 100644 index a1e5d0fa028..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_hourlyschedule.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type HourlySchedule struct { - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_monthlyschedule.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_monthlyschedule.go deleted file mode 100644 index 02cbcad6a59..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_monthlyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MonthlySchedule struct { - DaysOfMonth *string `json:"daysOfMonth,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicieslist.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicieslist.go deleted file mode 100644 index 910e2519adb..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPoliciesList struct { - Value *[]SnapshotPolicy `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicy.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicy.go deleted file mode 100644 index 310cfaaf1bb..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -package snapshotpolicy - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicy struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties SnapshotPolicyProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicypatch.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicypatch.go deleted file mode 100644 index 76df9be172b..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SnapshotPolicyProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicyproperties.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicyproperties.go deleted file mode 100644 index fb4fb0fcb05..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_snapshotpolicyproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyProperties struct { - DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` - MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_weeklyschedule.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/model_weeklyschedule.go deleted file mode 100644 index 128ece7ef5e..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/model_weeklyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type WeeklySchedule struct { - Day *string `json:"day,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicy/version.go b/resource-manager/netapp/2022-09-01/snapshotpolicy/version.go deleted file mode 100644 index 19e49253c53..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/README.md b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/README.md deleted file mode 100644 index e3b50a9a51a..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes` Documentation - -The `snapshotpolicylistvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/snapshotpolicylistvolumes" -``` - - -### Client Initialization - -```go -client := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyListVolumesClient.SnapshotPoliciesListVolumes` - -```go -ctx := context.TODO() -id := snapshotpolicylistvolumes.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesListVolumes(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go deleted file mode 100644 index 047d79a12c3..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPolicyListVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicylistvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) - } - - return &SnapshotPolicyListVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/constants.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/constants.go deleted file mode 100644 index 66a4d4da819..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/constants.go +++ /dev/null @@ -1,555 +0,0 @@ -package snapshotpolicylistvolumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go deleted file mode 100644 index 37d159192cf..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go deleted file mode 100644 index b7b4ebfa73a..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go deleted file mode 100644 index 95000d4db93..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPoliciesListVolumesOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicyVolumeList -} - -// SnapshotPoliciesListVolumes ... -func (c SnapshotPolicyListVolumesClient) SnapshotPoliciesListVolumes(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesListVolumesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_exportpolicyrule.go deleted file mode 100644 index dd6bb7a20fc..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_mounttargetproperties.go deleted file mode 100644 index 49f9f6f131a..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 0d5756a7089..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_replicationobject.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_replicationobject.go deleted file mode 100644 index 97bf50ea504..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go deleted file mode 100644 index 2d14e9596fe..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyVolumeList struct { - Value *[]Volume `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volume.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volume.go deleted file mode 100644 index 36417f52891..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumebackupproperties.go deleted file mode 100644 index e8fc89d03c8..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumebackupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumeproperties.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumeproperties.go deleted file mode 100644 index 94199d5c2d8..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumeproperties.go +++ /dev/null @@ -1,58 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index bf5ff10761d..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` - VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 1ad178d6e25..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go deleted file mode 100644 index 26ffc8f0697..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go deleted file mode 100644 index e4915375144..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/version.go b/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/version.go deleted file mode 100644 index 4f6b346365f..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshotpolicylistvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicylistvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/README.md b/resource-manager/netapp/2022-09-01/snapshots/README.md deleted file mode 100644 index 093aa08ae35..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/snapshots` Documentation - -The `snapshots` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/snapshots" -``` - - -### Client Initialization - -```go -client := snapshots.NewSnapshotsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotsClient.Create` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.Snapshot{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Delete` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Get` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.List` - -```go -ctx := context.TODO() -id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.RestoreFiles` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.SnapshotRestoreFiles{ - // ... -} - - -if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Update` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") -var payload interface{} - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/snapshots/client.go b/resource-manager/netapp/2022-09-01/snapshots/client.go deleted file mode 100644 index 620b7900eab..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshots - -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 SnapshotsClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) - } - - return &SnapshotsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go b/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go deleted file mode 100644 index 8a20d21ec27..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/id_snapshot.go +++ /dev/null @@ -1,152 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -// SnapshotId is a struct representing the Resource ID for a Snapshot -type SnapshotId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SnapshotName string -} - -// NewSnapshotID returns a new SnapshotId struct -func NewSnapshotID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, snapshotName string) SnapshotId { - return SnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SnapshotName: snapshotName, - } -} - -// ParseSnapshotID parses 'input' into a SnapshotId -func ParseSnapshotID(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotIDInsensitively parses 'input' case-insensitively into a SnapshotId -// note: this method should only be used for API response data and not user input -func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotId) 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) - } - - if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) - } - - return nil -} - -// ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID -func ValidateSnapshotID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSnapshotID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot ID -func (id SnapshotId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SnapshotName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot ID -func (id SnapshotId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), - resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), - } -} - -// String returns a human-readable description of this Snapshot ID -func (id SnapshotId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), - } - return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/id_snapshot_test.go b/resource-manager/netapp/2022-09-01/snapshots/id_snapshot_test.go deleted file mode 100644 index 4dd0b44f4a3..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/id_snapshot_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -func TestNewSnapshotID(t *testing.T) { - id := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SnapshotName != "snapshotValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotName'", id.SnapshotName, "snapshotValue") - } -} - -func TestFormatSnapshotID(t *testing.T) { - actual := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestParseSnapshotIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SnapshotName: "sNaPsHoTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestSegmentsForSnapshotId(t *testing.T) { - segments := SnapshotId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/id_volume.go b/resource-manager/netapp/2022-09-01/snapshots/id_volume.go deleted file mode 100644 index 06879ea6a3a..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/snapshots/id_volume_test.go b/resource-manager/netapp/2022-09-01/snapshots/id_volume_test.go deleted file mode 100644 index 6bcb01d8ea1..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/method_create.go b/resource-manager/netapp/2022-09-01/snapshots/method_create.go deleted file mode 100644 index 1c781284afe..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Create ... -func (c SnapshotsClient) Create(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusCreated, - }, - 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 SnapshotsClient) CreateThenPoll(ctx context.Context, id SnapshotId, input Snapshot) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/method_delete.go b/resource-manager/netapp/2022-09-01/snapshots/method_delete.go deleted file mode 100644 index ef16480f860..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SnapshotsClient) DeleteThenPoll(ctx context.Context, id SnapshotId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/method_get.go b/resource-manager/netapp/2022-09-01/snapshots/method_get.go deleted file mode 100644 index 4f024ded473..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/method_list.go b/resource-manager/netapp/2022-09-01/snapshots/method_list.go deleted file mode 100644 index f1079759c22..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotsList -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshots", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/method_restorefiles.go b/resource-manager/netapp/2022-09-01/snapshots/method_restorefiles.go deleted file mode 100644 index 685be44a5ff..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/method_restorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 RestoreFilesOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// RestoreFiles ... -func (c SnapshotsClient) RestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (result RestoreFilesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - 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 -} - -// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed -func (c SnapshotsClient) RestoreFilesThenPoll(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) error { - result, err := c.RestoreFiles(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RestoreFiles: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after RestoreFiles: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/method_update.go b/resource-manager/netapp/2022-09-01/snapshots/method_update.go deleted file mode 100644 index 656719e61bd..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Update ... -func (c SnapshotsClient) Update(ctx context.Context, id SnapshotId, input interface{}) (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 SnapshotsClient) UpdateThenPoll(ctx context.Context, id SnapshotId, input interface{}) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/model_snapshot.go b/resource-manager/netapp/2022-09-01/snapshots/model_snapshot.go deleted file mode 100644 index fe53e779a4c..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/model_snapshot.go +++ /dev/null @@ -1,17 +0,0 @@ -package snapshots - -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 Snapshot struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *SnapshotProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/model_snapshotproperties.go b/resource-manager/netapp/2022-09-01/snapshots/model_snapshotproperties.go deleted file mode 100644 index fe60537eaaa..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/model_snapshotproperties.go +++ /dev/null @@ -1,28 +0,0 @@ -package snapshots - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotProperties struct { - Created *string `json:"created,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` -} - -func (o *SnapshotProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *SnapshotProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/model_snapshotrestorefiles.go b/resource-manager/netapp/2022-09-01/snapshots/model_snapshotrestorefiles.go deleted file mode 100644 index de80d971dcf..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/model_snapshotrestorefiles.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotRestoreFiles struct { - DestinationPath *string `json:"destinationPath,omitempty"` - FilePaths []string `json:"filePaths"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/model_snapshotslist.go b/resource-manager/netapp/2022-09-01/snapshots/model_snapshotslist.go deleted file mode 100644 index bf283b0d2ac..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/model_snapshotslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotsList struct { - Value *[]Snapshot `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/snapshots/version.go b/resource-manager/netapp/2022-09-01/snapshots/version.go deleted file mode 100644 index 4cb8312dab7..00000000000 --- a/resource-manager/netapp/2022-09-01/snapshots/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshots - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshots/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/README.md b/resource-manager/netapp/2022-09-01/subvolumes/README.md deleted file mode 100644 index 0d75251759c..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/subvolumes` Documentation - -The `subvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/subvolumes" -``` - - -### Client Initialization - -```go -client := subvolumes.NewSubVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SubVolumesClient.Create` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumeInfo{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Delete` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Get` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -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: `SubVolumesClient.GetMetadata` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.GetMetadataThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.ListByVolume` - -```go -ctx := context.TODO() -id := subvolumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -// alternatively `client.ListByVolume(ctx, id)` can be used to do batched pagination -items, err := client.ListByVolumeComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `SubVolumesClient.Update` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumePatchRequest{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/subvolumes/client.go b/resource-manager/netapp/2022-09-01/subvolumes/client.go deleted file mode 100644 index b675258d906..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package subvolumes - -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 SubVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSubVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SubVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "subvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) - } - - return &SubVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go deleted file mode 100644 index 0649b6aeac0..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume.go +++ /dev/null @@ -1,152 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -// SubVolumeId is a struct representing the Resource ID for a Sub Volume -type SubVolumeId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SubVolumeName string -} - -// NewSubVolumeID returns a new SubVolumeId struct -func NewSubVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, subVolumeName string) SubVolumeId { - return SubVolumeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SubVolumeName: subVolumeName, - } -} - -// ParseSubVolumeID parses 'input' into a SubVolumeId -func ParseSubVolumeID(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSubVolumeIDInsensitively parses 'input' case-insensitively into a SubVolumeId -// note: this method should only be used for API response data and not user input -func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SubVolumeId) 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) - } - - if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) - } - - return nil -} - -// ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID -func ValidateSubVolumeID(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 := ParseSubVolumeID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Sub Volume ID -func (id SubVolumeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/subVolumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SubVolumeName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Sub Volume ID -func (id SubVolumeId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSubVolumes", "subVolumes", "subVolumes"), - resourceids.UserSpecifiedSegment("subVolumeName", "subVolumeValue"), - } -} - -// String returns a human-readable description of this Sub Volume ID -func (id SubVolumeId) 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), - fmt.Sprintf("Sub Volume Name: %q", id.SubVolumeName), - } - return fmt.Sprintf("Sub Volume (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume_test.go b/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume_test.go deleted file mode 100644 index f76df7c9c16..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/id_subvolume_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -func TestNewSubVolumeID(t *testing.T) { - id := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SubVolumeName != "subVolumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'SubVolumeName'", id.SubVolumeName, "subVolumeValue") - } -} - -func TestFormatSubVolumeID(t *testing.T) { - actual := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestParseSubVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SubVolumeName: "sUbVoLuMeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestSegmentsForSubVolumeId(t *testing.T) { - segments := SubVolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubVolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go b/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go deleted file mode 100644 index 8bbeb6c9e23..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/subvolumes/id_volume_test.go b/resource-manager/netapp/2022-09-01/subvolumes/id_volume_test.go deleted file mode 100644 index 7d4f6c8d6f1..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/method_create.go b/resource-manager/netapp/2022-09-01/subvolumes/method_create.go deleted file mode 100644 index 65a0d34e8d4..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -package subvolumes - -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 -} - -// Create ... -func (c SubVolumesClient) Create(ctx context.Context, id SubVolumeId, input SubvolumeInfo) (result CreateOperationResponse, 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 -} - -// CreateThenPoll performs Create then polls until it's completed -func (c SubVolumesClient) CreateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumeInfo) 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/resource-manager/netapp/2022-09-01/subvolumes/method_delete.go b/resource-manager/netapp/2022-09-01/subvolumes/method_delete.go deleted file mode 100644 index 2f19ed22f0c..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubVolumesClient) Delete(ctx context.Context, id SubVolumeId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SubVolumesClient) DeleteThenPoll(ctx context.Context, id SubVolumeId) 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/resource-manager/netapp/2022-09-01/subvolumes/method_get.go b/resource-manager/netapp/2022-09-01/subvolumes/method_get.go deleted file mode 100644 index 063628c3271..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package subvolumes - -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 *SubvolumeInfo -} - -// Get ... -func (c SubVolumesClient) Get(ctx context.Context, id SubVolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/method_getmetadata.go b/resource-manager/netapp/2022-09-01/subvolumes/method_getmetadata.go deleted file mode 100644 index a38be9004ef..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/method_getmetadata.go +++ /dev/null @@ -1,70 +0,0 @@ -package subvolumes - -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 GetMetadataOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// GetMetadata ... -func (c SubVolumesClient) GetMetadata(ctx context.Context, id SubVolumeId) (result GetMetadataOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/getMetadata", 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 -} - -// GetMetadataThenPoll performs GetMetadata then polls until it's completed -func (c SubVolumesClient) GetMetadataThenPoll(ctx context.Context, id SubVolumeId) error { - result, err := c.GetMetadata(ctx, id) - if err != nil { - return fmt.Errorf("performing GetMetadata: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after GetMetadata: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/method_listbyvolume.go b/resource-manager/netapp/2022-09-01/subvolumes/method_listbyvolume.go deleted file mode 100644 index 50bba7a698f..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/method_listbyvolume.go +++ /dev/null @@ -1,89 +0,0 @@ -package subvolumes - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]SubvolumeInfo -} - -type ListByVolumeCompleteResult struct { - Items []SubvolumeInfo -} - -// ListByVolume ... -func (c SubVolumesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/subVolumes", 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 *[]SubvolumeInfo `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListByVolumeComplete retrieves all the results into a single object -func (c SubVolumesClient) ListByVolumeComplete(ctx context.Context, id VolumeId) (ListByVolumeCompleteResult, error) { - return c.ListByVolumeCompleteMatchingPredicate(ctx, id, SubvolumeInfoOperationPredicate{}) -} - -// ListByVolumeCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c SubVolumesClient) ListByVolumeCompleteMatchingPredicate(ctx context.Context, id VolumeId, predicate SubvolumeInfoOperationPredicate) (result ListByVolumeCompleteResult, err error) { - items := make([]SubvolumeInfo, 0) - - resp, err := c.ListByVolume(ctx, id) - if err != nil { - 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 = ListByVolumeCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/method_update.go b/resource-manager/netapp/2022-09-01/subvolumes/method_update.go deleted file mode 100644 index 919d2776e7f..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package subvolumes - -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 -} - -// Update ... -func (c SubVolumesClient) Update(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) (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 SubVolumesClient) UpdateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) 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/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeinfo.go b/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeinfo.go deleted file mode 100644 index 3adbcfc6002..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeinfo.go +++ /dev/null @@ -1,16 +0,0 @@ -package subvolumes - -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 SubvolumeInfo struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodel.go b/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodel.go deleted file mode 100644 index d15828e2987..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodel.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeModelProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodelproperties.go b/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodelproperties.go deleted file mode 100644 index 26911c386fc..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumemodelproperties.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubvolumeModelProperties struct { - AccessedTimeStamp *string `json:"accessedTimeStamp,omitempty"` - BytesUsed *int64 `json:"bytesUsed,omitempty"` - ChangedTimeStamp *string `json:"changedTimeStamp,omitempty"` - CreationTimeStamp *string `json:"creationTimeStamp,omitempty"` - ModifiedTimeStamp *string `json:"modifiedTimeStamp,omitempty"` - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - Permissions *string `json:"permissions,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} - -func (o *SubvolumeModelProperties) GetAccessedTimeStampAsTime() (*time.Time, error) { - if o.AccessedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.AccessedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetAccessedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.AccessedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetChangedTimeStampAsTime() (*time.Time, error) { - if o.ChangedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ChangedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetChangedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ChangedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetCreationTimeStampAsTime() (*time.Time, error) { - if o.CreationTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreationTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetCreationTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreationTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetModifiedTimeStampAsTime() (*time.Time, error) { - if o.ModifiedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ModifiedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetModifiedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ModifiedTimeStamp = &formatted -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchparams.go b/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchparams.go deleted file mode 100644 index 02ea94ff0ac..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchparams.go +++ /dev/null @@ -1,9 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchParams struct { - Path *string `json:"path,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchrequest.go b/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchrequest.go deleted file mode 100644 index 0394a55073a..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumepatchrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchRequest struct { - Properties *SubvolumePatchParams `json:"properties,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeproperties.go b/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeproperties.go deleted file mode 100644 index 899e995183a..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/model_subvolumeproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeProperties struct { - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/subvolumes/predicates.go b/resource-manager/netapp/2022-09-01/subvolumes/predicates.go deleted file mode 100644 index af649a6bd08..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeInfoOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p SubvolumeInfoOperationPredicate) Matches(input SubvolumeInfo) 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/resource-manager/netapp/2022-09-01/subvolumes/version.go b/resource-manager/netapp/2022-09-01/subvolumes/version.go deleted file mode 100644 index 87ff8334107..00000000000 --- a/resource-manager/netapp/2022-09-01/subvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package subvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/subvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/README.md b/resource-manager/netapp/2022-09-01/volumegroups/README.md deleted file mode 100644 index 291a0159f45..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/README.md +++ /dev/null @@ -1,81 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumegroups` Documentation - -The `volumegroups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/volumegroups" -``` - - -### Client Initialization - -```go -client := volumegroups.NewVolumeGroupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeGroupsClient.Create` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -payload := volumegroups.VolumeGroupDetails{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Delete` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Get` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -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: `VolumeGroupsClient.ListByNetAppAccount` - -```go -ctx := context.TODO() -id := volumegroups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.ListByNetAppAccount(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-09-01/volumegroups/client.go b/resource-manager/netapp/2022-09-01/volumegroups/client.go deleted file mode 100644 index a117e697f04..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient struct { - Client *resourcemanager.Client -} - -func NewVolumeGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeGroupsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumegroups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) - } - - return &VolumeGroupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/constants.go b/resource-manager/netapp/2022-09-01/volumegroups/constants.go deleted file mode 100644 index 91f837115ef..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/constants.go +++ /dev/null @@ -1,593 +0,0 @@ -package volumegroups - -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 ApplicationType string - -const ( - ApplicationTypeSAPNegativeHANA ApplicationType = "SAP-HANA" -) - -func PossibleValuesForApplicationType() []string { - return []string{ - string(ApplicationTypeSAPNegativeHANA), - } -} - -func (s *ApplicationType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseApplicationType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseApplicationType(input string) (*ApplicationType, error) { - vals := map[string]ApplicationType{ - "sap-hana": ApplicationTypeSAPNegativeHANA, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ApplicationType(input) - return &out, nil -} - -type AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go deleted file mode 100644 index 180947b711b..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount_test.go b/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount_test.go deleted file mode 100644 index 42d30d6c431..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go deleted file mode 100644 index f97a6bb10bd..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -// VolumeGroupId is a struct representing the Resource ID for a Volume Group -type VolumeGroupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - VolumeGroupName string -} - -// NewVolumeGroupID returns a new VolumeGroupId struct -func NewVolumeGroupID(subscriptionId string, resourceGroupName string, netAppAccountName string, volumeGroupName string) VolumeGroupId { - return VolumeGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - VolumeGroupName: volumeGroupName, - } -} - -// ParseVolumeGroupID parses 'input' into a VolumeGroupId -func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeGroupIDInsensitively parses 'input' case-insensitively into a VolumeGroupId -// note: this method should only be used for API response data and not user input -func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeGroupId) 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.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) - } - - return nil -} - -// ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID -func ValidateVolumeGroupID(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 := ParseVolumeGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Group ID -func (id VolumeGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/volumeGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.VolumeGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Group ID -func (id VolumeGroupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticVolumeGroups", "volumeGroups", "volumeGroups"), - resourceids.UserSpecifiedSegment("volumeGroupName", "volumeGroupValue"), - } -} - -// String returns a human-readable description of this Volume Group ID -func (id VolumeGroupId) 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("Volume Group Name: %q", id.VolumeGroupName), - } - return fmt.Sprintf("Volume Group (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup_test.go b/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup_test.go deleted file mode 100644 index d8c69411672..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/id_volumegroup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -func TestNewVolumeGroupID(t *testing.T) { - id := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.VolumeGroupName != "volumeGroupValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeGroupName'", id.VolumeGroupName, "volumeGroupValue") - } -} - -func TestFormatVolumeGroupID(t *testing.T) { - actual := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestParseVolumeGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - VolumeGroupName: "vOlUmEgRoUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestSegmentsForVolumeGroupId(t *testing.T) { - segments := VolumeGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/method_create.go b/resource-manager/netapp/2022-09-01/volumegroups/method_create.go deleted file mode 100644 index 13500e108f3..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/method_create.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumegroups - -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 -} - -// Create ... -func (c VolumeGroupsClient) Create(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - }, - 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 VolumeGroupsClient) CreateThenPoll(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) 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/resource-manager/netapp/2022-09-01/volumegroups/method_delete.go b/resource-manager/netapp/2022-09-01/volumegroups/method_delete.go deleted file mode 100644 index 32e6c75b150..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient) Delete(ctx context.Context, id VolumeGroupId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeGroupsClient) DeleteThenPoll(ctx context.Context, id VolumeGroupId) 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/resource-manager/netapp/2022-09-01/volumegroups/method_get.go b/resource-manager/netapp/2022-09-01/volumegroups/method_get.go deleted file mode 100644 index 6a14cec40c4..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumegroups - -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 *VolumeGroupDetails -} - -// Get ... -func (c VolumeGroupsClient) Get(ctx context.Context, id VolumeGroupId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/method_listbynetappaccount.go b/resource-manager/netapp/2022-09-01/volumegroups/method_listbynetappaccount.go deleted file mode 100644 index 0a84dcdd8e0..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/method_listbynetappaccount.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumegroups - -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 *VolumeGroupList -} - -// ListByNetAppAccount ... -func (c VolumeGroupsClient) 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, - Path: fmt.Sprintf("%s/volumeGroups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_exportpolicyrule.go b/resource-manager/netapp/2022-09-01/volumegroups/model_exportpolicyrule.go deleted file mode 100644 index e17395ba1a7..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -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 ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_mounttargetproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_mounttargetproperties.go deleted file mode 100644 index 5844b80ce9d..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -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 MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-09-01/volumegroups/model_placementkeyvaluepairs.go deleted file mode 100644 index 1714b1662a1..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -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 PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_replicationobject.go b/resource-manager/netapp/2022-09-01/volumegroups/model_replicationobject.go deleted file mode 100644 index 6d145aa0079..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -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 ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumebackupproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumebackupproperties.go deleted file mode 100644 index 20e1850964e..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumebackupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -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 { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroup.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroup.go deleted file mode 100644 index 5e4df7bb9c0..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroup.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroup struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupListProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupdetails.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupdetails.go deleted file mode 100644 index 5f01af82c0f..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupdetails.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupDetails struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplist.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplist.go deleted file mode 100644 index 447c6e6e858..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeGroupList struct { - Value *[]VolumeGroup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplistproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplistproperties.go deleted file mode 100644 index 5788ee516fc..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegrouplistproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeGroupListProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupmetadata.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupmetadata.go deleted file mode 100644 index 30441c6826d..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupmetadata.go +++ /dev/null @@ -1,13 +0,0 @@ -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 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/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupproperties.go deleted file mode 100644 index 0bab153b397..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -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 VolumeGroupProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Volumes *[]VolumeGroupVolumeProperties `json:"volumes,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupvolumeproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupvolumeproperties.go deleted file mode 100644 index 61bbdab9ce3..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumegroupvolumeproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupVolumeProperties struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumeproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumeproperties.go deleted file mode 100644 index 6739c3dc1f2..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumeproperties.go +++ /dev/null @@ -1,58 +0,0 @@ -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 VolumeProperties struct { - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesdataprotection.go deleted file mode 100644 index 632e45e64b0..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -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 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/resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 227c8586d6f..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumerelocationproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumerelocationproperties.go deleted file mode 100644 index 4fea57c7396..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-09-01/volumegroups/model_volumesnapshotproperties.go deleted file mode 100644 index a3f5011da3b..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumegroups/version.go b/resource-manager/netapp/2022-09-01/volumegroups/version.go deleted file mode 100644 index 131b4cf4b78..00000000000 --- a/resource-manager/netapp/2022-09-01/volumegroups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumegroups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumegroups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/README.md b/resource-manager/netapp/2022-09-01/volumequotarules/README.md deleted file mode 100644 index 439db04b87a..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumequotarules` Documentation - -The `volumequotarules` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/volumequotarules" -``` - - -### Client Initialization - -```go -client := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeQuotaRulesClient.Create` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRule{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Delete` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Get` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -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: `VolumeQuotaRulesClient.ListByVolume` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.ListByVolume(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Update` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRulePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/client.go b/resource-manager/netapp/2022-09-01/volumequotarules/client.go deleted file mode 100644 index c6c70e112e0..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient struct { - Client *resourcemanager.Client -} - -func NewVolumeQuotaRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeQuotaRulesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumequotarules", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) - } - - return &VolumeQuotaRulesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/constants.go b/resource-manager/netapp/2022-09-01/volumequotarules/constants.go deleted file mode 100644 index fb0e41e1afb..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/constants.go +++ /dev/null @@ -1,113 +0,0 @@ -package volumequotarules - -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 ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStatePatching ProvisioningState = "Patching" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateMoving), - string(ProvisioningStatePatching), - string(ProvisioningStateSucceeded), - } -} - -func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseProvisioningState(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "moving": ProvisioningStateMoving, - "patching": ProvisioningStatePatching, - "succeeded": ProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type Type string - -const ( - TypeDefaultGroupQuota Type = "DefaultGroupQuota" - TypeDefaultUserQuota Type = "DefaultUserQuota" - TypeIndividualGroupQuota Type = "IndividualGroupQuota" - TypeIndividualUserQuota Type = "IndividualUserQuota" -) - -func PossibleValuesForType() []string { - return []string{ - string(TypeDefaultGroupQuota), - string(TypeDefaultUserQuota), - string(TypeIndividualGroupQuota), - string(TypeIndividualUserQuota), - } -} - -func (s *Type) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseType(input string) (*Type, error) { - vals := map[string]Type{ - "defaultgroupquota": TypeDefaultGroupQuota, - "defaultuserquota": TypeDefaultUserQuota, - "individualgroupquota": TypeIndividualGroupQuota, - "individualuserquota": TypeIndividualUserQuota, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Type(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go b/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go deleted file mode 100644 index b3d6ab761b3..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/volumequotarules/id_volume_test.go b/resource-manager/netapp/2022-09-01/volumequotarules/id_volume_test.go deleted file mode 100644 index 98a3bd4ff39..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go deleted file mode 100644 index 711a80ae5cd..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule.go +++ /dev/null @@ -1,152 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -// VolumeQuotaRuleId is a struct representing the Resource ID for a Volume Quota Rule -type VolumeQuotaRuleId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - VolumeQuotaRuleName string -} - -// NewVolumeQuotaRuleID returns a new VolumeQuotaRuleId struct -func NewVolumeQuotaRuleID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, volumeQuotaRuleName string) VolumeQuotaRuleId { - return VolumeQuotaRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - VolumeQuotaRuleName: volumeQuotaRuleName, - } -} - -// ParseVolumeQuotaRuleID parses 'input' into a VolumeQuotaRuleId -func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeQuotaRuleIDInsensitively parses 'input' case-insensitively into a VolumeQuotaRuleId -// note: this method should only be used for API response data and not user input -func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeQuotaRuleId) 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) - } - - if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) - } - - return nil -} - -// ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID -func ValidateVolumeQuotaRuleID(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 := ParseVolumeQuotaRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Quota Rule ID -func (id VolumeQuotaRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/volumeQuotaRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.VolumeQuotaRuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticVolumeQuotaRules", "volumeQuotaRules", "volumeQuotaRules"), - resourceids.UserSpecifiedSegment("volumeQuotaRuleName", "volumeQuotaRuleValue"), - } -} - -// String returns a human-readable description of this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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), - fmt.Sprintf("Volume Quota Rule Name: %q", id.VolumeQuotaRuleName), - } - return fmt.Sprintf("Volume Quota Rule (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule_test.go b/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule_test.go deleted file mode 100644 index a6f3c9d15ab..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/id_volumequotarule_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -func TestNewVolumeQuotaRuleID(t *testing.T) { - id := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.VolumeQuotaRuleName != "volumeQuotaRuleValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeQuotaRuleName'", id.VolumeQuotaRuleName, "volumeQuotaRuleValue") - } -} - -func TestFormatVolumeQuotaRuleID(t *testing.T) { - actual := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeQuotaRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestParseVolumeQuotaRuleIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - VolumeQuotaRuleName: "vOlUmEqUoTaRuLeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestSegmentsForVolumeQuotaRuleId(t *testing.T) { - segments := VolumeQuotaRuleId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeQuotaRuleId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/method_create.go b/resource-manager/netapp/2022-09-01/volumequotarules/method_create.go deleted file mode 100644 index f052dfadc2f..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Create ... -func (c VolumeQuotaRulesClient) Create(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) (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 VolumeQuotaRulesClient) CreateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) 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/resource-manager/netapp/2022-09-01/volumequotarules/method_delete.go b/resource-manager/netapp/2022-09-01/volumequotarules/method_delete.go deleted file mode 100644 index 59d6fbecf0a..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient) Delete(ctx context.Context, id VolumeQuotaRuleId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeQuotaRulesClient) DeleteThenPoll(ctx context.Context, id VolumeQuotaRuleId) 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/resource-manager/netapp/2022-09-01/volumequotarules/method_get.go b/resource-manager/netapp/2022-09-01/volumequotarules/method_get.go deleted file mode 100644 index bed8822bc79..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumequotarules - -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 *VolumeQuotaRule -} - -// Get ... -func (c VolumeQuotaRulesClient) Get(ctx context.Context, id VolumeQuotaRuleId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/method_listbyvolume.go b/resource-manager/netapp/2022-09-01/volumequotarules/method_listbyvolume.go deleted file mode 100644 index 1bdc8b8007c..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/method_listbyvolume.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumequotarules - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VolumeQuotaRulesList -} - -// ListByVolume ... -func (c VolumeQuotaRulesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumeQuotaRules", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/method_update.go b/resource-manager/netapp/2022-09-01/volumequotarules/method_update.go deleted file mode 100644 index 2201827bac1..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Update ... -func (c VolumeQuotaRulesClient) Update(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) (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 VolumeQuotaRulesClient) UpdateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) 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/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarule.go b/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarule.go deleted file mode 100644 index 9436f5c0008..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarule.go +++ /dev/null @@ -1,18 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRule struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulepatch.go b/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulepatch.go deleted file mode 100644 index fbf72546c43..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulepatch.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulePatch struct { - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotaruleslist.go b/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotaruleslist.go deleted file mode 100644 index d9e15cf8035..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotaruleslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesList struct { - Value *[]VolumeQuotaRule `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulesproperties.go b/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulesproperties.go deleted file mode 100644 index 5ae037e0a23..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/model_volumequotarulesproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesProperties struct { - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - QuotaSizeInKiBs *int64 `json:"quotaSizeInKiBs,omitempty"` - QuotaTarget *string `json:"quotaTarget,omitempty"` - QuotaType *Type `json:"quotaType,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumequotarules/version.go b/resource-manager/netapp/2022-09-01/volumequotarules/version.go deleted file mode 100644 index 5762c58c57f..00000000000 --- a/resource-manager/netapp/2022-09-01/volumequotarules/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumequotarules - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumequotarules/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/volumes/README.md b/resource-manager/netapp/2022-09-01/volumes/README.md deleted file mode 100644 index 927defc68eb..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumes` Documentation - -The `volumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/volumes" -``` - - -### Client Initialization - -```go -client := volumes.NewVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.Volume{ - // ... -} - - -if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Delete` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Get` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesClient.List` - -```go -ctx := context.TODO() -id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `VolumesClient.Update` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.VolumePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/volumes/client.go b/resource-manager/netapp/2022-09-01/volumes/client.go deleted file mode 100644 index 9f34fb4a6eb..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumes - -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 VolumesClient struct { - Client *resourcemanager.Client -} - -func NewVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) - } - - return &VolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumes/constants.go b/resource-manager/netapp/2022-09-01/volumes/constants.go deleted file mode 100644 index 914cfb8d535..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/constants.go +++ /dev/null @@ -1,555 +0,0 @@ -package volumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go b/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go deleted file mode 100644 index 9ce092f4fe4..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-09-01/volumes/id_capacitypool_test.go b/resource-manager/netapp/2022-09-01/volumes/id_capacitypool_test.go deleted file mode 100644 index 055d673d4be..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumes/id_volume.go b/resource-manager/netapp/2022-09-01/volumes/id_volume.go deleted file mode 100644 index 0b27e4a330c..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/volumes/id_volume_test.go b/resource-manager/netapp/2022-09-01/volumes/id_volume_test.go deleted file mode 100644 index 6c6b2858724..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumes/method_createorupdate.go b/resource-manager/netapp/2022-09-01/volumes/method_createorupdate.go deleted file mode 100644 index 87a3cdb945a..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/method_createorupdate.go +++ /dev/null @@ -1,75 +0,0 @@ -package volumes - -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 -} - -// CreateOrUpdate ... -func (c VolumesClient) CreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (result CreateOrUpdateOperationResponse, 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 -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c VolumesClient) CreateOrUpdateThenPoll(ctx context.Context, id VolumeId, input Volume) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumes/method_delete.go b/resource-manager/netapp/2022-09-01/volumes/method_delete.go deleted file mode 100644 index 23734d43ae5..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/method_delete.go +++ /dev/null @@ -1,98 +0,0 @@ -package volumes - -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 -} - -type DeleteOperationOptions struct { - ForceDelete *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o DeleteOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - return &out -} - -func (o DeleteOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.ForceDelete != nil { - out.Append("forceDelete", fmt.Sprintf("%v", *o.ForceDelete)) - } - return &out -} - -// Delete ... -func (c VolumesClient) Delete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (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(), - OptionsObject: options, - } - - 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 VolumesClient) DeleteThenPoll(ctx context.Context, id VolumeId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumes/method_get.go b/resource-manager/netapp/2022-09-01/volumes/method_get.go deleted file mode 100644 index f7865a3e320..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumes - -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 *Volume -} - -// Get ... -func (c VolumesClient) Get(ctx context.Context, id VolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumes/method_list.go b/resource-manager/netapp/2022-09-01/volumes/method_list.go deleted file mode 100644 index aeea477a83f..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/method_list.go +++ /dev/null @@ -1,89 +0,0 @@ -package volumes - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]Volume -} - -type ListCompleteResult struct { - Items []Volume -} - -// List ... -func (c VolumesClient) List(ctx context.Context, id CapacityPoolId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 *[]Volume `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListComplete retrieves all the results into a single object -func (c VolumesClient) ListComplete(ctx context.Context, id CapacityPoolId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, VolumeOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c VolumesClient) ListCompleteMatchingPredicate(ctx context.Context, id CapacityPoolId, predicate VolumeOperationPredicate) (result ListCompleteResult, err error) { - items := make([]Volume, 0) - - resp, err := c.List(ctx, id) - if err != nil { - 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 = ListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-09-01/volumes/method_update.go b/resource-manager/netapp/2022-09-01/volumes/method_update.go deleted file mode 100644 index 57573abc0e0..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumes - -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 -} - -// Update ... -func (c VolumesClient) Update(ctx context.Context, id VolumeId, input VolumePatch) (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 VolumesClient) UpdateThenPoll(ctx context.Context, id VolumeId, input VolumePatch) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-09-01/volumes/model_exportpolicyrule.go deleted file mode 100644 index 9b059c74757..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-09-01/volumes/model_mounttargetproperties.go deleted file mode 100644 index 7f5c238183c..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-09-01/volumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 588e9729c1e..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_replicationobject.go b/resource-manager/netapp/2022-09-01/volumes/model_replicationobject.go deleted file mode 100644 index b7d6873811e..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volume.go b/resource-manager/netapp/2022-09-01/volumes/model_volume.go deleted file mode 100644 index 1679818444b..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package volumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-09-01/volumes/model_volumebackupproperties.go deleted file mode 100644 index 73d11e763f1..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumebackupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumepatch.go b/resource-manager/netapp/2022-09-01/volumes/model_volumepatch.go deleted file mode 100644 index b39ea01aee8..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumepatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumePatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumepatchproperties.go b/resource-manager/netapp/2022-09-01/volumes/model_volumepatchproperties.go deleted file mode 100644 index 5fab8a90ed1..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumepatchproperties.go +++ /dev/null @@ -1,18 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold *int64 `json:"usageThreshold,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesdataprotection.go b/resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesdataprotection.go deleted file mode 100644 index 8c9edc10ff7..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesdataprotection.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesexportpolicy.go b/resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesexportpolicy.go deleted file mode 100644 index ae83a5fc1b4..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumepatchpropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumeproperties.go b/resource-manager/netapp/2022-09-01/volumes/model_volumeproperties.go deleted file mode 100644 index 15a5bd5f4aa..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumeproperties.go +++ /dev/null @@ -1,58 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index fcf952952d2..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` - VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index fda5f4739de..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumerelocationproperties.go b/resource-manager/netapp/2022-09-01/volumes/model_volumerelocationproperties.go deleted file mode 100644 index 23274832779..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-09-01/volumes/model_volumesnapshotproperties.go deleted file mode 100644 index 48aba2acce0..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumes/predicates.go b/resource-manager/netapp/2022-09-01/volumes/predicates.go deleted file mode 100644 index fcc54ae5e26..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -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 VolumeOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p VolumeOperationPredicate) Matches(input Volume) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-09-01/volumes/version.go b/resource-manager/netapp/2022-09-01/volumes/version.go deleted file mode 100644 index be8ea9bd289..00000000000 --- a/resource-manager/netapp/2022-09-01/volumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/README.md b/resource-manager/netapp/2022-09-01/volumesrelocation/README.md deleted file mode 100644 index c76f3d27946..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/README.md +++ /dev/null @@ -1,61 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesrelocation` Documentation - -The `volumesrelocation` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/volumesrelocation" -``` - - -### Client Initialization - -```go -client := volumesrelocation.NewVolumesRelocationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRelocationClient.VolumesFinalizeRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesFinalizeRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRelocate` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrelocation.RelocateVolumeRequest{ - // ... -} - - -if err := client.VolumesRelocateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRevertRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesRevertRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/client.go b/resource-manager/netapp/2022-09-01/volumesrelocation/client.go deleted file mode 100644 index 9170c859f6f..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrelocation - -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 VolumesRelocationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRelocationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRelocationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrelocation", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) - } - - return &VolumesRelocationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go deleted file mode 100644 index c10d0bf30cd..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrelocation - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume_test.go b/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume_test.go deleted file mode 100644 index 1956a28a604..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrelocation - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesfinalizerelocation.go b/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesfinalizerelocation.go deleted file mode 100644 index 8bc1cc1b39a..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesfinalizerelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesFinalizeRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesFinalizeRelocation ... -func (c VolumesRelocationClient) VolumesFinalizeRelocation(ctx context.Context, id VolumeId) (result VolumesFinalizeRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/finalizeRelocation", 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 -} - -// VolumesFinalizeRelocationThenPoll performs VolumesFinalizeRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesFinalizeRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesFinalizeRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesFinalizeRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesFinalizeRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrelocate.go b/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrelocate.go deleted file mode 100644 index 1207d489ed4..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrelocate.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrelocation - -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 VolumesRelocateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRelocate ... -func (c VolumesRelocationClient) VolumesRelocate(ctx context.Context, id VolumeId, input RelocateVolumeRequest) (result VolumesRelocateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/relocate", 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 -} - -// VolumesRelocateThenPoll performs VolumesRelocate then polls until it's completed -func (c VolumesRelocationClient) VolumesRelocateThenPoll(ctx context.Context, id VolumeId, input RelocateVolumeRequest) error { - result, err := c.VolumesRelocate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRelocate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRelocate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrevertrelocation.go b/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrevertrelocation.go deleted file mode 100644 index 0091b1304fd..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/method_volumesrevertrelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesRevertRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevertRelocation ... -func (c VolumesRelocationClient) VolumesRevertRelocation(ctx context.Context, id VolumeId) (result VolumesRevertRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revertRelocation", 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 -} - -// VolumesRevertRelocationThenPoll performs VolumesRevertRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesRevertRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesRevertRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesRevertRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevertRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/model_relocatevolumerequest.go b/resource-manager/netapp/2022-09-01/volumesrelocation/model_relocatevolumerequest.go deleted file mode 100644 index 25cb3a56801..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/model_relocatevolumerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrelocation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RelocateVolumeRequest struct { - CreationToken *string `json:"creationToken,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesrelocation/version.go b/resource-manager/netapp/2022-09-01/volumesrelocation/version.go deleted file mode 100644 index e5a304b89bd..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrelocation/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrelocation - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrelocation/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/README.md b/resource-manager/netapp/2022-09-01/volumesreplication/README.md deleted file mode 100644 index 73f521b3609..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/README.md +++ /dev/null @@ -1,139 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesreplication` Documentation - -The `volumesreplication` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/volumesreplication" -``` - - -### Client Initialization - -```go -client := volumesreplication.NewVolumesReplicationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesReplicationClient.VolumesAuthorizeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.AuthorizeRequest{ - // ... -} - - -if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesBreakReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.BreakReplicationRequest{ - // ... -} - - -if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesDeleteReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesListReplications` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesListReplications(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReInitializeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReestablishReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.ReestablishReplicationRequest{ - // ... -} - - -if err := client.VolumesReestablishReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReplicationStatus` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesReplicationStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesResyncReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/client.go b/resource-manager/netapp/2022-09-01/volumesreplication/client.go deleted file mode 100644 index 278506e484e..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesreplication - -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 VolumesReplicationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesReplicationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesReplicationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesreplication", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) - } - - return &VolumesReplicationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/constants.go b/resource-manager/netapp/2022-09-01/volumesreplication/constants.go deleted file mode 100644 index 2e5196391b7..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/constants.go +++ /dev/null @@ -1,180 +0,0 @@ -package volumesreplication - -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 EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go b/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go deleted file mode 100644 index c68d5f31c45..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesreplication - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/volumesreplication/id_volume_test.go b/resource-manager/netapp/2022-09-01/volumesreplication/id_volume_test.go deleted file mode 100644 index b7b6501115b..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesreplication - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesauthorizereplication.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesauthorizereplication.go deleted file mode 100644 index 591d7c626ab..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesauthorizereplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesAuthorizeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesAuthorizeReplication ... -func (c VolumesReplicationClient) VolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (result VolumesAuthorizeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/authorizeReplication", 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 -} - -// VolumesAuthorizeReplicationThenPoll performs VolumesAuthorizeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesAuthorizeReplicationThenPoll(ctx context.Context, id VolumeId, input AuthorizeRequest) error { - result, err := c.VolumesAuthorizeReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesAuthorizeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesAuthorizeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesbreakreplication.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesbreakreplication.go deleted file mode 100644 index 280008e8175..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesbreakreplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesBreakReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakReplication ... -func (c VolumesReplicationClient) VolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (result VolumesBreakReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakReplication", 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 -} - -// VolumesBreakReplicationThenPoll performs VolumesBreakReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesBreakReplicationThenPoll(ctx context.Context, id VolumeId, input BreakReplicationRequest) error { - result, err := c.VolumesBreakReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesdeletereplication.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesdeletereplication.go deleted file mode 100644 index cda9737c512..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesdeletereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesDeleteReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesDeleteReplication ... -func (c VolumesReplicationClient) VolumesDeleteReplication(ctx context.Context, id VolumeId) (result VolumesDeleteReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/deleteReplication", 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 -} - -// VolumesDeleteReplicationThenPoll performs VolumesDeleteReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesDeleteReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesDeleteReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesDeleteReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesDeleteReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumeslistreplications.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumeslistreplications.go deleted file mode 100644 index c85aaaca41b..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumeslistreplications.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesListReplicationsOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ListReplications -} - -// VolumesListReplications ... -func (c VolumesReplicationClient) VolumesListReplications(ctx context.Context, id VolumeId) (result VolumesListReplicationsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/listReplications", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreestablishreplication.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreestablishreplication.go deleted file mode 100644 index 047fc04a7f9..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreestablishreplication.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumesreplication - -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 VolumesReestablishReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReestablishReplication ... -func (c VolumesReplicationClient) VolumesReestablishReplication(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) (result VolumesReestablishReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reestablishReplication", 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 -} - -// VolumesReestablishReplicationThenPoll performs VolumesReestablishReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReestablishReplicationThenPoll(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) error { - result, err := c.VolumesReestablishReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesReestablishReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReestablishReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreinitializereplication.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreinitializereplication.go deleted file mode 100644 index 3f479bf637a..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreinitializereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesReInitializeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReInitializeReplication ... -func (c VolumesReplicationClient) VolumesReInitializeReplication(ctx context.Context, id VolumeId) (result VolumesReInitializeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reinitializeReplication", 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 -} - -// VolumesReInitializeReplicationThenPoll performs VolumesReInitializeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReInitializeReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesReInitializeReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesReInitializeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReInitializeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreplicationstatus.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreplicationstatus.go deleted file mode 100644 index af1138c5648..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesreplicationstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesReplicationStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ReplicationStatus -} - -// VolumesReplicationStatus ... -func (c VolumesReplicationClient) VolumesReplicationStatus(ctx context.Context, id VolumeId) (result VolumesReplicationStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/replicationStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesresyncreplication.go b/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesresyncreplication.go deleted file mode 100644 index 23e1a66f518..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/method_volumesresyncreplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesResyncReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResyncReplication ... -func (c VolumesReplicationClient) VolumesResyncReplication(ctx context.Context, id VolumeId) (result VolumesResyncReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resyncReplication", 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 -} - -// VolumesResyncReplicationThenPoll performs VolumesResyncReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesResyncReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResyncReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResyncReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResyncReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/model_authorizerequest.go b/resource-manager/netapp/2022-09-01/volumesreplication/model_authorizerequest.go deleted file mode 100644 index ff1cefa31ef..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/model_authorizerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthorizeRequest struct { - RemoteVolumeResourceId *string `json:"remoteVolumeResourceId,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/model_breakreplicationrequest.go b/resource-manager/netapp/2022-09-01/volumesreplication/model_breakreplicationrequest.go deleted file mode 100644 index b6a0a179a9c..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/model_breakreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakReplicationRequest struct { - ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/model_listreplications.go b/resource-manager/netapp/2022-09-01/volumesreplication/model_listreplications.go deleted file mode 100644 index 7929ea4ace4..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/model_listreplications.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListReplications struct { - Value *[]Replication `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/model_reestablishreplicationrequest.go b/resource-manager/netapp/2022-09-01/volumesreplication/model_reestablishreplicationrequest.go deleted file mode 100644 index 193b71f1490..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/model_reestablishreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReestablishReplicationRequest struct { - SourceVolumeId *string `json:"sourceVolumeId,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/model_replication.go b/resource-manager/netapp/2022-09-01/volumesreplication/model_replication.go deleted file mode 100644 index 06e345fdb5e..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/model_replication.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Replication struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/model_replicationstatus.go b/resource-manager/netapp/2022-09-01/volumesreplication/model_replicationstatus.go deleted file mode 100644 index 2a79dddf7a4..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/model_replicationstatus.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalProgress *string `json:"totalProgress,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesreplication/version.go b/resource-manager/netapp/2022-09-01/volumesreplication/version.go deleted file mode 100644 index dc1fbf894f9..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesreplication/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesreplication/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/README.md b/resource-manager/netapp/2022-09-01/volumesrevert/README.md deleted file mode 100644 index 4e977b66a6d..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-09-01/volumesrevert` Documentation - -The `volumesrevert` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-09-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/2022-09-01/volumesrevert" -``` - - -### Client Initialization - -```go -client := volumesrevert.NewVolumesRevertClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRevertClient.VolumesRevert` - -```go -ctx := context.TODO() -id := volumesrevert.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrevert.VolumeRevert{ - // ... -} - - -if err := client.VolumesRevertThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/client.go b/resource-manager/netapp/2022-09-01/volumesrevert/client.go deleted file mode 100644 index fa2bad78d7b..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrevert - -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 VolumesRevertClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRevertClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRevertClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrevert", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) - } - - return &VolumesRevertClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go b/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go deleted file mode 100644 index 576a30b9904..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrevert - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-09-01/volumesrevert/id_volume_test.go b/resource-manager/netapp/2022-09-01/volumesrevert/id_volume_test.go deleted file mode 100644 index 46df3f272f2..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrevert - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/method_volumesrevert.go b/resource-manager/netapp/2022-09-01/volumesrevert/method_volumesrevert.go deleted file mode 100644 index 0be129fdd47..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/method_volumesrevert.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrevert - -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 VolumesRevertOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevert ... -func (c VolumesRevertClient) VolumesRevert(ctx context.Context, id VolumeId, input VolumeRevert) (result VolumesRevertOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revert", 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 -} - -// VolumesRevertThenPoll performs VolumesRevert then polls until it's completed -func (c VolumesRevertClient) VolumesRevertThenPoll(ctx context.Context, id VolumeId, input VolumeRevert) error { - result, err := c.VolumesRevert(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRevert: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevert: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/model_volumerevert.go b/resource-manager/netapp/2022-09-01/volumesrevert/model_volumerevert.go deleted file mode 100644 index c5adf461cf8..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/model_volumerevert.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrevert - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRevert struct { - SnapshotId *string `json:"snapshotId,omitempty"` -} diff --git a/resource-manager/netapp/2022-09-01/volumesrevert/version.go b/resource-manager/netapp/2022-09-01/volumesrevert/version.go deleted file mode 100644 index a009aae1e91..00000000000 --- a/resource-manager/netapp/2022-09-01/volumesrevert/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrevert - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-09-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrevert/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/README.md b/resource-manager/netapp/2022-11-01-preview/backuppolicy/README.md deleted file mode 100644 index c784e774709..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/backuppolicy` Documentation - -The `backuppolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue") - -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", "netAppAccountValue", "backupPolicyValue") - -payload := backuppolicy.BackupPolicyPatch{ - // ... -} - - -if err := client.BackupPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/client.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/client.go deleted file mode 100644 index 1db45e634e5..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backuppolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) - } - - return &BackupPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go deleted file mode 100644 index f16f0b462b8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), - resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy_test.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy_test.go deleted file mode 100644 index 577058e02d3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_backuppolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupPolicyId{} - -func TestNewBackupPolicyID(t *testing.T) { - id := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupPolicyName != "backupPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupPolicyName'", id.BackupPolicyName, "backupPolicyValue") - } -} - -func TestFormatBackupPolicyID(t *testing.T) { - actual := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestParseBackupPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupPolicyName: "bAcKuPpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestSegmentsForBackupPolicyId(t *testing.T) { - segments := BackupPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go deleted file mode 100644 index 6b11cb40365..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount_test.go deleted file mode 100644 index 2d0f311d8d1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciescreate.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciescreate.go deleted file mode 100644 index f0b9cef4c28..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciescreate.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesdelete.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesdelete.go deleted file mode 100644 index 482cdc1780e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesget.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesget.go deleted file mode 100644 index 95b4f6f56a8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppolicieslist.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppolicieslist.go deleted file mode 100644 index 2730e8afc34..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesupdate.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesupdate.go deleted file mode 100644 index 8e5456d63ac..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/method_backuppoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicieslist.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicieslist.go deleted file mode 100644 index 3db3d131a60..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicy.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicy.go deleted file mode 100644 index 747ab65be24..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicypatch.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicypatch.go deleted file mode 100644 index bf7eecb1358..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicyproperties.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicyproperties.go deleted file mode 100644 index d5694f4797d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_backuppolicyproperties.go +++ /dev/null @@ -1,15 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_volumebackups.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_volumebackups.go deleted file mode 100644 index c01a5c25fd5..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/model_volumebackups.go +++ /dev/null @@ -1,10 +0,0 @@ -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"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/backuppolicy/version.go b/resource-manager/netapp/2022-11-01-preview/backuppolicy/version.go deleted file mode 100644 index 32b43932ece..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backuppolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backuppolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backuppolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/README.md b/resource-manager/netapp/2022-11-01-preview/backups/README.md deleted file mode 100644 index a80110044a4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/README.md +++ /dev/null @@ -1,210 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/backups` Documentation - -The `backups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/backups" -``` - - -### Client Initialization - -```go -client := backups.NewBackupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupsClient.AccountBackupsDelete` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -if err := client.AccountBackupsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsGet` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -read, err := client.AccountBackupsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsListByNetAppAccount` - -```go -ctx := context.TODO() -id := backups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountBackupsListByNetAppAccount(ctx, id, backups.DefaultAccountBackupsListByNetAppAccountOperationOptions()) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.Create` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue", "backupValue") - -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", "netAppAccountValue", "backupVaultValue", "backupValue") - -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", "netAppAccountValue", "backupVaultValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -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", "netAppAccountValue", "backupVaultValue") - -// 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", "netAppAccountValue") - -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", "netAppAccountValue", "backupVaultValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -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", "netAppAccountValue", "backupVaultValue", "backupValue") - -payload := backups.BackupPatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/backups/client.go b/resource-manager/netapp/2022-11-01-preview/backups/client.go deleted file mode 100644 index a0f81d2a6ab..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) - } - - return &BackupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/constants.go b/resource-manager/netapp/2022-11-01-preview/backups/constants.go deleted file mode 100644 index e2ac45e345b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/constants.go +++ /dev/null @@ -1,136 +0,0 @@ -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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go b/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go deleted file mode 100644 index b4091d27265..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup.go +++ /dev/null @@ -1,134 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -// AccountBackupId is a struct representing the Resource ID for a Account Backup -type AccountBackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - AccountBackupName string -} - -// NewAccountBackupID returns a new AccountBackupId struct -func NewAccountBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, accountBackupName string) AccountBackupId { - return AccountBackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - AccountBackupName: accountBackupName, - } -} - -// ParseAccountBackupID parses 'input' into a AccountBackupId -func ParseAccountBackupID(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseAccountBackupIDInsensitively parses 'input' case-insensitively into a AccountBackupId -// note: this method should only be used for API response data and not user input -func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *AccountBackupId) 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.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) - } - - return nil -} - -// ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID -func ValidateAccountBackupID(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 := ParseAccountBackupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account Backup ID -func (id AccountBackupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/accountBackups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.AccountBackupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account Backup ID -func (id AccountBackupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticAccountBackups", "accountBackups", "accountBackups"), - resourceids.UserSpecifiedSegment("accountBackupName", "accountBackupValue"), - } -} - -// String returns a human-readable description of this Account Backup ID -func (id AccountBackupId) 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("Account Backup Name: %q", id.AccountBackupName), - } - return fmt.Sprintf("Account Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup_test.go b/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup_test.go deleted file mode 100644 index 5371bde3e0a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_accountbackup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -func TestNewAccountBackupID(t *testing.T) { - id := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.AccountBackupName != "accountBackupValue" { - t.Fatalf("Expected %q but got %q for Segment 'AccountBackupName'", id.AccountBackupName, "accountBackupValue") - } -} - -func TestFormatAccountBackupID(t *testing.T) { - actual := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseAccountBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestParseAccountBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - AccountBackupName: "aCcOuNtBaCkUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestSegmentsForAccountBackupId(t *testing.T) { - segments := AccountBackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("AccountBackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go b/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go deleted file mode 100644 index ec7b08aa37f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_backup.go +++ /dev/null @@ -1,143 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), - resourceids.StaticSegment("staticBackups", "backups", "backups"), - resourceids.UserSpecifiedSegment("backupName", "backupValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backups/id_backup_test.go b/resource-manager/netapp/2022-11-01-preview/backups/id_backup_test.go deleted file mode 100644 index 4c95ce9365d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_backup_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -func TestNewBackupID(t *testing.T) { - id := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue", "backupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupVaultName != "backupVaultValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupVaultName'", id.BackupVaultName, "backupVaultValue") - } - - if id.BackupName != "backupValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupName'", id.BackupName, "backupValue") - } -} - -func TestFormatBackupID(t *testing.T) { - actual := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue", "backupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups/backupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupVaultName: "backupVaultValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups/backupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupVaultName != v.Expected.BackupVaultName { - t.Fatalf("Expected %q but got %q for BackupVaultName", v.Expected.BackupVaultName, actual.BackupVaultName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestParseBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE/bAcKuPs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupVaultName: "backupVaultValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/backups/backupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE/bAcKuPs/bAcKuPvAlUe", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupVaultName: "bAcKuPvAuLtVaLuE", - BackupName: "bAcKuPvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE/bAcKuPs/bAcKuPvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupVaultName != v.Expected.BackupVaultName { - t.Fatalf("Expected %q but got %q for BackupVaultName", v.Expected.BackupVaultName, actual.BackupVaultName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestSegmentsForBackupId(t *testing.T) { - segments := BackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go b/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go deleted file mode 100644 index 5f9227f4c54..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault.go +++ /dev/null @@ -1,134 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault_test.go b/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault_test.go deleted file mode 100644 index 352621d4494..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_backupvault_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupVaultId{} - -func TestNewBackupVaultID(t *testing.T) { - id := NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupVaultName != "backupVaultValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupVaultName'", id.BackupVaultName, "backupVaultValue") - } -} - -func TestFormatBackupVaultID(t *testing.T) { - actual := NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupVaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue", - Expected: &BackupVaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupVaultName: "backupVaultValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupVaultName != v.Expected.BackupVaultName { - t.Fatalf("Expected %q but got %q for BackupVaultName", v.Expected.BackupVaultName, actual.BackupVaultName) - } - - } -} - -func TestParseBackupVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupVaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue", - Expected: &BackupVaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupVaultName: "backupVaultValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE", - Expected: &BackupVaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupVaultName: "bAcKuPvAuLtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupVaultName != v.Expected.BackupVaultName { - t.Fatalf("Expected %q but got %q for BackupVaultName", v.Expected.BackupVaultName, actual.BackupVaultName) - } - - } -} - -func TestSegmentsForBackupVaultId(t *testing.T) { - segments := BackupVaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupVaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go deleted file mode 100644 index ced6c2088e0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount_test.go deleted file mode 100644 index bc4a37eeffd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go b/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go deleted file mode 100644 index 247b20b073e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/backups/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/backups/id_volume_test.go deleted file mode 100644 index d8f88fb84a4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsdelete.go b/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsdelete.go deleted file mode 100644 index a55df55cf2e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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 AccountBackupsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountBackupsDelete ... -func (c BackupsClient) AccountBackupsDelete(ctx context.Context, id AccountBackupId) (result AccountBackupsDeleteOperationResponse, 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 -} - -// AccountBackupsDeleteThenPoll performs AccountBackupsDelete then polls until it's completed -func (c BackupsClient) AccountBackupsDeleteThenPoll(ctx context.Context, id AccountBackupId) error { - result, err := c.AccountBackupsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountBackupsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountBackupsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsget.go b/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsget.go deleted file mode 100644 index 1f242db5125..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupsget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 AccountBackupsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *Backup -} - -// AccountBackupsGet ... -func (c BackupsClient) AccountBackupsGet(ctx context.Context, id AccountBackupId) (result AccountBackupsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupslistbynetappaccount.go b/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupslistbynetappaccount.go deleted file mode 100644 index 17828877d32..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_accountbackupslistbynetappaccount.go +++ /dev/null @@ -1,80 +0,0 @@ -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 AccountBackupsListByNetAppAccountOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -type AccountBackupsListByNetAppAccountOperationOptions struct { - IncludeOnlyBackupsFromDeletedVolumes *string -} - -func DefaultAccountBackupsListByNetAppAccountOperationOptions() AccountBackupsListByNetAppAccountOperationOptions { - return AccountBackupsListByNetAppAccountOperationOptions{} -} - -func (o AccountBackupsListByNetAppAccountOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o AccountBackupsListByNetAppAccountOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - return &out -} - -func (o AccountBackupsListByNetAppAccountOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.IncludeOnlyBackupsFromDeletedVolumes != nil { - out.Append("includeOnlyBackupsFromDeletedVolumes", fmt.Sprintf("%v", *o.IncludeOnlyBackupsFromDeletedVolumes)) - } - return &out -} - -// AccountBackupsListByNetAppAccount ... -func (c BackupsClient) AccountBackupsListByNetAppAccount(ctx context.Context, id NetAppAccountId, options AccountBackupsListByNetAppAccountOperationOptions) (result AccountBackupsListByNetAppAccountOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/accountBackups", id.ID()), - OptionsObject: options, - } - - 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_create.go b/resource-manager/netapp/2022-11-01-preview/backups/method_create.go deleted file mode 100644 index 0e97dd6521a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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.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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backups/method_delete.go b/resource-manager/netapp/2022-11-01-preview/backups/method_delete.go deleted file mode 100644 index 3472a05fa69..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -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, - 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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backups/method_get.go b/resource-manager/netapp/2022-11-01-preview/backups/method_get.go deleted file mode 100644 index 4ea8ec97737..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_getlateststatus.go b/resource-manager/netapp/2022-11-01-preview/backups/method_getlateststatus.go deleted file mode 100644 index c0ee39cfe12..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_getlateststatus.go +++ /dev/null @@ -1,52 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_listbyvault.go b/resource-manager/netapp/2022-11-01-preview/backups/method_listbyvault.go deleted file mode 100644 index 004a702e34e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_listbyvault.go +++ /dev/null @@ -1,117 +0,0 @@ -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 { - 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 -} - -// 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, - Path: fmt.Sprintf("%s/backups", id.ID()), - OptionsObject: options, - } - - 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 { - 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{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/method_underaccountmigratebackups.go b/resource-manager/netapp/2022-11-01-preview/backups/method_underaccountmigratebackups.go deleted file mode 100644 index fcb76802c7e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_underaccountmigratebackups.go +++ /dev/null @@ -1,74 +0,0 @@ -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, - http.StatusNoContent, - }, - 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/resource-manager/netapp/2022-11-01-preview/backups/method_underbackupvaultrestorefiles.go b/resource-manager/netapp/2022-11-01-preview/backups/method_underbackupvaultrestorefiles.go deleted file mode 100644 index b5b2e1d6323..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_underbackupvaultrestorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -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, - http.StatusNoContent, - }, - 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/resource-manager/netapp/2022-11-01-preview/backups/method_undervolumemigratebackups.go b/resource-manager/netapp/2022-11-01-preview/backups/method_undervolumemigratebackups.go deleted file mode 100644 index e70dbb05a7d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_undervolumemigratebackups.go +++ /dev/null @@ -1,74 +0,0 @@ -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, - http.StatusNoContent, - }, - 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/resource-manager/netapp/2022-11-01-preview/backups/method_update.go b/resource-manager/netapp/2022-11-01-preview/backups/method_update.go deleted file mode 100644 index 38c6398f381..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backups/model_backup.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backup.go deleted file mode 100644 index ef5ef0a7bc6..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backup.go +++ /dev/null @@ -1,16 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/model_backuppatch.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backuppatch.go deleted file mode 100644 index a87251f4b0c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backuppatch.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/model_backuppatchproperties.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backuppatchproperties.go deleted file mode 100644 index b374bda3143..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backuppatchproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/model_backupproperties.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backupproperties.go deleted file mode 100644 index 706547a7be1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backupproperties.go +++ /dev/null @@ -1,35 +0,0 @@ -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"` - 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/resource-manager/netapp/2022-11-01-preview/backups/model_backuprestorefiles.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backuprestorefiles.go deleted file mode 100644 index e26ce886407..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backuprestorefiles.go +++ /dev/null @@ -1,10 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/model_backupslist.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backupslist.go deleted file mode 100644 index 53fa244a9f3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backupslist.go +++ /dev/null @@ -1,9 +0,0 @@ -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 BackupsList struct { - NextLink *string `json:"nextLink,omitempty"` - Value *[]Backup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/backups/model_backupsmigrationrequest.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backupsmigrationrequest.go deleted file mode 100644 index f0fb612b507..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backupsmigrationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/model_backupstatus.go b/resource-manager/netapp/2022-11-01-preview/backups/model_backupstatus.go deleted file mode 100644 index e873cd9463d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/model_backupstatus.go +++ /dev/null @@ -1,16 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/predicates.go b/resource-manager/netapp/2022-11-01-preview/backups/predicates.go deleted file mode 100644 index f5033a2bb91..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backups/version.go b/resource-manager/netapp/2022-11-01-preview/backups/version.go deleted file mode 100644 index 868221591c8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/README.md b/resource-manager/netapp/2022-11-01-preview/backupvaults/README.md deleted file mode 100644 index 5b105dc06f9..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/backupvaults` Documentation - -The `backupvaults` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/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", "netAppAccountValue", "backupVaultValue") - -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", "netAppAccountValue", "backupVaultValue") - -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", "netAppAccountValue", "backupVaultValue") - -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", "netAppAccountValue") - -// 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", "netAppAccountValue", "backupVaultValue") - -payload := backupvaults.BackupVaultPatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/client.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/client.go deleted file mode 100644 index 7a4dd932170..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backupvaults", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupVaultsClient: %+v", err) - } - - return &BackupVaultsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go deleted file mode 100644 index 740bed9355f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault.go +++ /dev/null @@ -1,134 +0,0 @@ -package backupvaults - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupVaults", "backupVaults", "backupVaults"), - resourceids.UserSpecifiedSegment("backupVaultName", "backupVaultValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault_test.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault_test.go deleted file mode 100644 index a18647af9a1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_backupvault_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backupvaults - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupVaultId{} - -func TestNewBackupVaultID(t *testing.T) { - id := NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupVaultName != "backupVaultValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupVaultName'", id.BackupVaultName, "backupVaultValue") - } -} - -func TestFormatBackupVaultID(t *testing.T) { - actual := NewBackupVaultID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupVaultValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupVaultID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupVaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue", - Expected: &BackupVaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupVaultName: "backupVaultValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupVaultID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupVaultName != v.Expected.BackupVaultName { - t.Fatalf("Expected %q but got %q for BackupVaultName", v.Expected.BackupVaultName, actual.BackupVaultName) - } - - } -} - -func TestParseBackupVaultIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupVaultId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue", - Expected: &BackupVaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupVaultName: "backupVaultValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupVaults/backupVaultValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE", - Expected: &BackupVaultId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupVaultName: "bAcKuPvAuLtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPvAuLtS/bAcKuPvAuLtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupVaultIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupVaultName != v.Expected.BackupVaultName { - t.Fatalf("Expected %q but got %q for BackupVaultName", v.Expected.BackupVaultName, actual.BackupVaultName) - } - - } -} - -func TestSegmentsForBackupVaultId(t *testing.T) { - segments := BackupVaultId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupVaultId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go deleted file mode 100644 index 9be4411d949..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backupvaults - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount_test.go deleted file mode 100644 index af974c76fd6..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backupvaults - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_createorupdate.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/method_createorupdate.go deleted file mode 100644 index 81a602b9379..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_createorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backupvaults/method_delete.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/method_delete.go deleted file mode 100644 index 6899d5db814..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -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, - 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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backupvaults/method_get.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/method_get.go deleted file mode 100644 index 10c9c1107b0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_listbynetappaccount.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/method_listbynetappaccount.go deleted file mode 100644 index 41f80c2885c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_listbynetappaccount.go +++ /dev/null @@ -1,89 +0,0 @@ -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 { - Items []BackupVault -} - -// 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, - 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 { - 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{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_update.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/method_update.go deleted file mode 100644 index 2c94936818d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvault.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvault.go deleted file mode 100644 index 0e8761f2293..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvault.go +++ /dev/null @@ -1,18 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultpatch.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultpatch.go deleted file mode 100644 index 899e2ecf858..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultpatch.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultproperties.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultproperties.go deleted file mode 100644 index 7327d4d2119..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/model_backupvaultproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backupvaults/predicates.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/predicates.go deleted file mode 100644 index 53d942f568c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/predicates.go +++ /dev/null @@ -1,32 +0,0 @@ -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/resource-manager/netapp/2022-11-01-preview/backupvaults/version.go b/resource-manager/netapp/2022-11-01-preview/backupvaults/version.go deleted file mode 100644 index d4c8292d0d6..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/backupvaults/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backupvaults - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backupvaults/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/README.md b/resource-manager/netapp/2022-11-01-preview/capacitypools/README.md deleted file mode 100644 index 626e338a288..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/capacitypools` Documentation - -The `capacitypools` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/capacitypools" -``` - - -### Client Initialization - -```go -client := capacitypools.NewCapacityPoolsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `CapacityPoolsClient.PoolsCreateOrUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPool{ - // ... -} - - -if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsDelete` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsGet` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -read, err := client.PoolsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsList` - -```go -ctx := context.TODO() -id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -// alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination -items, err := client.PoolsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPoolPatch{ - // ... -} - - -if err := client.PoolsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/client.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/client.go deleted file mode 100644 index 3de33a3dc5b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package capacitypools - -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 CapacityPoolsClient struct { - Client *resourcemanager.Client -} - -func NewCapacityPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityPoolsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "capacitypools", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) - } - - return &CapacityPoolsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/constants.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/constants.go deleted file mode 100644 index 802074e5dc1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/constants.go +++ /dev/null @@ -1,139 +0,0 @@ -package capacitypools - -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 EncryptionType string - -const ( - EncryptionTypeDouble EncryptionType = "Double" - EncryptionTypeSingle EncryptionType = "Single" -) - -func PossibleValuesForEncryptionType() []string { - return []string{ - string(EncryptionTypeDouble), - string(EncryptionTypeSingle), - } -} - -func (s *EncryptionType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionType(input string) (*EncryptionType, error) { - vals := map[string]EncryptionType{ - "double": EncryptionTypeDouble, - "single": EncryptionTypeSingle, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionType(input) - return &out, nil -} - -type QosType string - -const ( - QosTypeAuto QosType = "Auto" - QosTypeManual QosType = "Manual" -) - -func PossibleValuesForQosType() []string { - return []string{ - string(QosTypeAuto), - string(QosTypeManual), - } -} - -func (s *QosType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseQosType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseQosType(input string) (*QosType, error) { - vals := map[string]QosType{ - "auto": QosTypeAuto, - "manual": QosTypeManual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QosType(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go deleted file mode 100644 index 69954702fd9..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool_test.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool_test.go deleted file mode 100644 index a7eaff1ee66..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go deleted file mode 100644 index f424e58a9e8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount_test.go deleted file mode 100644 index 13bb52f3713..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolscreateorupdate.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolscreateorupdate.go deleted file mode 100644 index d25b060fccf..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsCreateOrUpdate ... -func (c CapacityPoolsClient) PoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (result PoolsCreateOrUpdateOperationResponse, 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 -} - -// PoolsCreateOrUpdateThenPoll performs PoolsCreateOrUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsCreateOrUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPool) error { - result, err := c.PoolsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsdelete.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsdelete.go deleted file mode 100644 index 36c9e0e6bcf..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package capacitypools - -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 PoolsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsDelete ... -func (c CapacityPoolsClient) PoolsDelete(ctx context.Context, id CapacityPoolId) (result PoolsDeleteOperationResponse, 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 -} - -// PoolsDeleteThenPoll performs PoolsDelete then polls until it's completed -func (c CapacityPoolsClient) PoolsDeleteThenPoll(ctx context.Context, id CapacityPoolId) error { - result, err := c.PoolsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PoolsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsget.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsget.go deleted file mode 100644 index 26acc6641bb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package capacitypools - -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 PoolsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CapacityPool -} - -// PoolsGet ... -func (c CapacityPoolsClient) PoolsGet(ctx context.Context, id CapacityPoolId) (result PoolsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolslist.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolslist.go deleted file mode 100644 index 9b29e63dbdb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolslist.go +++ /dev/null @@ -1,89 +0,0 @@ -package capacitypools - -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 PoolsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]CapacityPool -} - -type PoolsListCompleteResult struct { - Items []CapacityPool -} - -// PoolsList ... -func (c CapacityPoolsClient) PoolsList(ctx context.Context, id NetAppAccountId) (result PoolsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/capacityPools", 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 *[]CapacityPool `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// PoolsListComplete retrieves all the results into a single object -func (c CapacityPoolsClient) PoolsListComplete(ctx context.Context, id NetAppAccountId) (PoolsListCompleteResult, error) { - return c.PoolsListCompleteMatchingPredicate(ctx, id, CapacityPoolOperationPredicate{}) -} - -// PoolsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c CapacityPoolsClient) PoolsListCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate CapacityPoolOperationPredicate) (result PoolsListCompleteResult, err error) { - items := make([]CapacityPool, 0) - - resp, err := c.PoolsList(ctx, id) - if err != nil { - 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 = PoolsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsupdate.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsupdate.go deleted file mode 100644 index 7396db6d249..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/method_poolsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsUpdate ... -func (c CapacityPoolsClient) PoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (result PoolsUpdateOperationResponse, 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 -} - -// PoolsUpdateThenPoll performs PoolsUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) error { - result, err := c.PoolsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypool.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypool.go deleted file mode 100644 index f5d6f1ea86d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypool.go +++ /dev/null @@ -1,19 +0,0 @@ -package capacitypools - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPool struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties PoolProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypoolpatch.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypoolpatch.go deleted file mode 100644 index 46abcde6b33..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_capacitypoolpatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PoolPatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolpatchproperties.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolpatchproperties.go deleted file mode 100644 index c971dd8637c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolpatchproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolPatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolproperties.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolproperties.go deleted file mode 100644 index a1fee733fb4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/model_poolproperties.go +++ /dev/null @@ -1,16 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - EncryptionType *EncryptionType `json:"encryptionType,omitempty"` - PoolId *string `json:"poolId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - ServiceLevel ServiceLevel `json:"serviceLevel"` - Size int64 `json:"size"` - TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` - UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/predicates.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/predicates.go deleted file mode 100644 index 386a7986d42..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p CapacityPoolOperationPredicate) Matches(input CapacityPool) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-11-01-preview/capacitypools/version.go b/resource-manager/netapp/2022-11-01-preview/capacitypools/version.go deleted file mode 100644 index 1e674d9cc66..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/capacitypools/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package capacitypools - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/capacitypools/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/client.go b/resource-manager/netapp/2022-11-01-preview/client.go deleted file mode 100644 index ffec41bfd96..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/client.go +++ /dev/null @@ -1,208 +0,0 @@ -package v2022_11_01_preview - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/backuppolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/backups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/backupvaults" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/capacitypools" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/filelocks" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/netappaccounts" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/netappresource" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/poolchange" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/resetcifspassword" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/restore" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/snapshotpolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/snapshots" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/subvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumesrelocation" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumesreplication" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumesrevert" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" -) - -type Client struct { - BackupPolicy *backuppolicy.BackupPolicyClient - BackupVaults *backupvaults.BackupVaultsClient - Backups *backups.BackupsClient - CapacityPools *capacitypools.CapacityPoolsClient - FileLocks *filelocks.FileLocksClient - GroupIdListForLDAPUser *groupidlistforldapuser.GroupIdListForLDAPUserClient - NetAppAccounts *netappaccounts.NetAppAccountsClient - NetAppResource *netappresource.NetAppResourceClient - PoolChange *poolchange.PoolChangeClient - ResetCifsPassword *resetcifspassword.ResetCifsPasswordClient - Restore *restore.RestoreClient - SnapshotPolicy *snapshotpolicy.SnapshotPolicyClient - SnapshotPolicyListVolumes *snapshotpolicylistvolumes.SnapshotPolicyListVolumesClient - Snapshots *snapshots.SnapshotsClient - SubVolumes *subvolumes.SubVolumesClient - VolumeGroups *volumegroups.VolumeGroupsClient - VolumeQuotaRules *volumequotarules.VolumeQuotaRulesClient - Volumes *volumes.VolumesClient - VolumesRelocation *volumesrelocation.VolumesRelocationClient - VolumesReplication *volumesreplication.VolumesReplicationClient - VolumesRevert *volumesrevert.VolumesRevertClient -} - -func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { - backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building BackupPolicy client: %+v", err) - } - configureFunc(backupPolicyClient.Client) - - backupVaultsClient, err := backupvaults.NewBackupVaultsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building BackupVaults client: %+v", err) - } - configureFunc(backupVaultsClient.Client) - - backupsClient, err := backups.NewBackupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Backups client: %+v", err) - } - configureFunc(backupsClient.Client) - - capacityPoolsClient, err := capacitypools.NewCapacityPoolsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building CapacityPools client: %+v", err) - } - configureFunc(capacityPoolsClient.Client) - - fileLocksClient, err := filelocks.NewFileLocksClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building FileLocks client: %+v", err) - } - configureFunc(fileLocksClient.Client) - - groupIdListForLDAPUserClient, err := groupidlistforldapuser.NewGroupIdListForLDAPUserClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building GroupIdListForLDAPUser client: %+v", err) - } - configureFunc(groupIdListForLDAPUserClient.Client) - - netAppAccountsClient, err := netappaccounts.NewNetAppAccountsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppAccounts client: %+v", err) - } - configureFunc(netAppAccountsClient.Client) - - netAppResourceClient, err := netappresource.NewNetAppResourceClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppResource client: %+v", err) - } - configureFunc(netAppResourceClient.Client) - - poolChangeClient, err := poolchange.NewPoolChangeClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building PoolChange client: %+v", err) - } - configureFunc(poolChangeClient.Client) - - resetCifsPasswordClient, err := resetcifspassword.NewResetCifsPasswordClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building ResetCifsPassword client: %+v", err) - } - configureFunc(resetCifsPasswordClient.Client) - - restoreClient, err := restore.NewRestoreClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Restore client: %+v", err) - } - configureFunc(restoreClient.Client) - - snapshotPolicyClient, err := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicy client: %+v", err) - } - configureFunc(snapshotPolicyClient.Client) - - snapshotPolicyListVolumesClient, err := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicyListVolumes client: %+v", err) - } - configureFunc(snapshotPolicyListVolumesClient.Client) - - snapshotsClient, err := snapshots.NewSnapshotsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Snapshots client: %+v", err) - } - configureFunc(snapshotsClient.Client) - - subVolumesClient, err := subvolumes.NewSubVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SubVolumes client: %+v", err) - } - configureFunc(subVolumesClient.Client) - - volumeGroupsClient, err := volumegroups.NewVolumeGroupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeGroups client: %+v", err) - } - configureFunc(volumeGroupsClient.Client) - - volumeQuotaRulesClient, err := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeQuotaRules client: %+v", err) - } - configureFunc(volumeQuotaRulesClient.Client) - - volumesClient, err := volumes.NewVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Volumes client: %+v", err) - } - configureFunc(volumesClient.Client) - - volumesRelocationClient, err := volumesrelocation.NewVolumesRelocationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRelocation client: %+v", err) - } - configureFunc(volumesRelocationClient.Client) - - volumesReplicationClient, err := volumesreplication.NewVolumesReplicationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesReplication client: %+v", err) - } - configureFunc(volumesReplicationClient.Client) - - volumesRevertClient, err := volumesrevert.NewVolumesRevertClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRevert client: %+v", err) - } - configureFunc(volumesRevertClient.Client) - - return &Client{ - BackupPolicy: backupPolicyClient, - BackupVaults: backupVaultsClient, - Backups: backupsClient, - CapacityPools: capacityPoolsClient, - FileLocks: fileLocksClient, - GroupIdListForLDAPUser: groupIdListForLDAPUserClient, - NetAppAccounts: netAppAccountsClient, - NetAppResource: netAppResourceClient, - PoolChange: poolChangeClient, - ResetCifsPassword: resetCifsPasswordClient, - Restore: restoreClient, - SnapshotPolicy: snapshotPolicyClient, - SnapshotPolicyListVolumes: snapshotPolicyListVolumesClient, - Snapshots: snapshotsClient, - SubVolumes: subVolumesClient, - VolumeGroups: volumeGroupsClient, - VolumeQuotaRules: volumeQuotaRulesClient, - Volumes: volumesClient, - VolumesRelocation: volumesRelocationClient, - VolumesReplication: volumesReplicationClient, - VolumesRevert: volumesRevertClient, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/README.md b/resource-manager/netapp/2022-11-01-preview/filelocks/README.md deleted file mode 100644 index 13bb75a786f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/filelocks` Documentation - -The `filelocks` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/filelocks" -``` - - -### Client Initialization - -```go -client := filelocks.NewFileLocksClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `FileLocksClient.VolumesBreakFileLocks` - -```go -ctx := context.TODO() -id := filelocks.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := filelocks.BreakFileLocksRequest{ - // ... -} - - -if err := client.VolumesBreakFileLocksThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/client.go b/resource-manager/netapp/2022-11-01-preview/filelocks/client.go deleted file mode 100644 index 7f39f5ef46b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package filelocks - -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 FileLocksClient struct { - Client *resourcemanager.Client -} - -func NewFileLocksClientWithBaseURI(sdkApi sdkEnv.Api) (*FileLocksClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "filelocks", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating FileLocksClient: %+v", err) - } - - return &FileLocksClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go b/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go deleted file mode 100644 index 446434f9140..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package filelocks - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume_test.go deleted file mode 100644 index ba5d9fabf43..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package filelocks - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/method_volumesbreakfilelocks.go b/resource-manager/netapp/2022-11-01-preview/filelocks/method_volumesbreakfilelocks.go deleted file mode 100644 index c1ff2b4b86f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/method_volumesbreakfilelocks.go +++ /dev/null @@ -1,74 +0,0 @@ -package filelocks - -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 VolumesBreakFileLocksOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakFileLocks ... -func (c FileLocksClient) VolumesBreakFileLocks(ctx context.Context, id VolumeId, input BreakFileLocksRequest) (result VolumesBreakFileLocksOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakFileLocks", 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 -} - -// VolumesBreakFileLocksThenPoll performs VolumesBreakFileLocks then polls until it's completed -func (c FileLocksClient) VolumesBreakFileLocksThenPoll(ctx context.Context, id VolumeId, input BreakFileLocksRequest) error { - result, err := c.VolumesBreakFileLocks(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakFileLocks: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakFileLocks: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/model_breakfilelocksrequest.go b/resource-manager/netapp/2022-11-01-preview/filelocks/model_breakfilelocksrequest.go deleted file mode 100644 index 62fa9fc9808..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/model_breakfilelocksrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package filelocks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakFileLocksRequest struct { - ClientIP *string `json:"clientIp,omitempty"` - ConfirmRunningDisruptiveOperation *bool `json:"confirmRunningDisruptiveOperation,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/filelocks/version.go b/resource-manager/netapp/2022-11-01-preview/filelocks/version.go deleted file mode 100644 index 8cd3f2d29c6..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/filelocks/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package filelocks - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/filelocks/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/README.md b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/README.md deleted file mode 100644 index b399431dce2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser` Documentation - -The `groupidlistforldapuser` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/groupidlistforldapuser" -``` - - -### Client Initialization - -```go -client := groupidlistforldapuser.NewGroupIdListForLDAPUserClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `GroupIdListForLDAPUserClient.VolumesListGetGroupIdListForLdapUser` - -```go -ctx := context.TODO() -id := groupidlistforldapuser.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := groupidlistforldapuser.GetGroupIdListForLDAPUserRequest{ - // ... -} - - -if err := client.VolumesListGetGroupIdListForLdapUserThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/client.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/client.go deleted file mode 100644 index b954d6fe7dc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package groupidlistforldapuser - -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 GroupIdListForLDAPUserClient struct { - Client *resourcemanager.Client -} - -func NewGroupIdListForLDAPUserClientWithBaseURI(sdkApi sdkEnv.Api) (*GroupIdListForLDAPUserClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "groupidlistforldapuser", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating GroupIdListForLDAPUserClient: %+v", err) - } - - return &GroupIdListForLDAPUserClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go deleted file mode 100644 index af00678327a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package groupidlistforldapuser - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume_test.go deleted file mode 100644 index f43d498174d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package groupidlistforldapuser - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go deleted file mode 100644 index e062e65052e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go +++ /dev/null @@ -1,74 +0,0 @@ -package groupidlistforldapuser - -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 VolumesListGetGroupIdListForLdapUserOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesListGetGroupIdListForLdapUser ... -func (c GroupIdListForLDAPUserClient) VolumesListGetGroupIdListForLdapUser(ctx context.Context, id VolumeId, input GetGroupIdListForLDAPUserRequest) (result VolumesListGetGroupIdListForLdapUserOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/getGroupIdListForLdapUser", 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 -} - -// VolumesListGetGroupIdListForLdapUserThenPoll performs VolumesListGetGroupIdListForLdapUser then polls until it's completed -func (c GroupIdListForLDAPUserClient) VolumesListGetGroupIdListForLdapUserThenPoll(ctx context.Context, id VolumeId, input GetGroupIdListForLDAPUserRequest) error { - result, err := c.VolumesListGetGroupIdListForLdapUser(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesListGetGroupIdListForLdapUser: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesListGetGroupIdListForLdapUser: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go deleted file mode 100644 index 797ecd9aa2a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package groupidlistforldapuser - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetGroupIdListForLDAPUserRequest struct { - Username string `json:"username"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go deleted file mode 100644 index 42c528df2f2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go +++ /dev/null @@ -1,8 +0,0 @@ -package groupidlistforldapuser - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetGroupIdListForLDAPUserResponse struct { - GroupIdsForLdapUser *[]string `json:"groupIdsForLdapUser,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/version.go b/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/version.go deleted file mode 100644 index 548c712fe1e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/groupidlistforldapuser/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package groupidlistforldapuser - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/groupidlistforldapuser/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/README.md b/resource-manager/netapp/2022-11-01-preview/netappaccounts/README.md deleted file mode 100644 index 5c2caad8ba2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/README.md +++ /dev/null @@ -1,128 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/netappaccounts` Documentation - -The `netappaccounts` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/netappaccounts" -``` - - -### Client Initialization - -```go -client := netappaccounts.NewNetAppAccountsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppAccountsClient.AccountsCreateOrUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccount{ - // ... -} - - -if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsDelete` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsGet` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsList` - -```go -ctx := context.TODO() -id := netappaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsListBySubscription` - -```go -ctx := context.TODO() -id := netappaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.AccountsListBySubscription(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListBySubscriptionComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsRenewCredentials` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsRenewCredentialsThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccountPatch{ - // ... -} - - -if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/client.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/client.go deleted file mode 100644 index 172f1218e2c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappaccounts - -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 NetAppAccountsClient struct { - Client *resourcemanager.Client -} - -func NewNetAppAccountsClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppAccountsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappaccounts", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) - } - - return &NetAppAccountsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/constants.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/constants.go deleted file mode 100644 index f8d0489c2a0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/constants.go +++ /dev/null @@ -1,151 +0,0 @@ -package netappaccounts - -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 ActiveDirectoryStatus string - -const ( - ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" - ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" - ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" - ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" - ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" -) - -func PossibleValuesForActiveDirectoryStatus() []string { - return []string{ - string(ActiveDirectoryStatusCreated), - string(ActiveDirectoryStatusDeleted), - string(ActiveDirectoryStatusError), - string(ActiveDirectoryStatusInUse), - string(ActiveDirectoryStatusUpdating), - } -} - -func (s *ActiveDirectoryStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseActiveDirectoryStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseActiveDirectoryStatus(input string) (*ActiveDirectoryStatus, error) { - vals := map[string]ActiveDirectoryStatus{ - "created": ActiveDirectoryStatusCreated, - "deleted": ActiveDirectoryStatusDeleted, - "error": ActiveDirectoryStatusError, - "inuse": ActiveDirectoryStatusInUse, - "updating": ActiveDirectoryStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ActiveDirectoryStatus(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" - KeySourceMicrosoftPointNetApp KeySource = "Microsoft.NetApp" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceMicrosoftPointKeyVault), - string(KeySourceMicrosoftPointNetApp), - } -} - -func (s *KeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, - "microsoft.netapp": KeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type KeyVaultStatus string - -const ( - KeyVaultStatusCreated KeyVaultStatus = "Created" - KeyVaultStatusDeleted KeyVaultStatus = "Deleted" - KeyVaultStatusError KeyVaultStatus = "Error" - KeyVaultStatusInUse KeyVaultStatus = "InUse" - KeyVaultStatusUpdating KeyVaultStatus = "Updating" -) - -func PossibleValuesForKeyVaultStatus() []string { - return []string{ - string(KeyVaultStatusCreated), - string(KeyVaultStatusDeleted), - string(KeyVaultStatusError), - string(KeyVaultStatusInUse), - string(KeyVaultStatusUpdating), - } -} - -func (s *KeyVaultStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeyVaultStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeyVaultStatus(input string) (*KeyVaultStatus, error) { - vals := map[string]KeyVaultStatus{ - "created": KeyVaultStatusCreated, - "deleted": KeyVaultStatusDeleted, - "error": KeyVaultStatusError, - "inuse": KeyVaultStatusInUse, - "updating": KeyVaultStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyVaultStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go deleted file mode 100644 index 07a8ef7a579..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappaccounts - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount_test.go deleted file mode 100644 index 0e58b3e4d97..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappaccounts - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountscreateorupdate.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountscreateorupdate.go deleted file mode 100644 index 7d7c0d2ca88..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsCreateOrUpdate ... -func (c NetAppAccountsClient) AccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (result AccountsCreateOrUpdateOperationResponse, 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 -} - -// AccountsCreateOrUpdateThenPoll performs AccountsCreateOrUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsCreateOrUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccount) error { - result, err := c.AccountsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsdelete.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsdelete.go deleted file mode 100644 index ae46b7b061d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsDelete ... -func (c NetAppAccountsClient) AccountsDelete(ctx context.Context, id NetAppAccountId) (result AccountsDeleteOperationResponse, 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 -} - -// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed -func (c NetAppAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsget.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsget.go deleted file mode 100644 index 4cc63a91e9f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappaccounts - -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 AccountsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *NetAppAccount -} - -// AccountsGet ... -func (c NetAppAccountsClient) AccountsGet(ctx context.Context, id NetAppAccountId) (result AccountsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslist.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslist.go deleted file mode 100644 index 3f16fbcc847..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslist.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListCompleteResult struct { - Items []NetAppAccount -} - -// AccountsList ... -func (c NetAppAccountsClient) AccountsList(ctx context.Context, id commonids.ResourceGroupId) (result AccountsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListCompleteResult, error) { - return c.AccountsListCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetAppAccountOperationPredicate) (result AccountsListCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsList(ctx, id) - if err != nil { - 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 = AccountsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslistbysubscription.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslistbysubscription.go deleted file mode 100644 index 0b66b7c904a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountslistbysubscription.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListBySubscriptionCompleteResult struct { - Items []NetAppAccount -} - -// AccountsListBySubscription ... -func (c NetAppAccountsClient) AccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result AccountsListBySubscriptionOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListBySubscriptionComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListBySubscriptionCompleteResult, error) { - return c.AccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetAppAccountOperationPredicate) (result AccountsListBySubscriptionCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsListBySubscription(ctx, id) - if err != nil { - 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 = AccountsListBySubscriptionCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsrenewcredentials.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsrenewcredentials.go deleted file mode 100644 index 4d7aca0b151..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsrenewcredentials.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsRenewCredentialsOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsRenewCredentials ... -func (c NetAppAccountsClient) AccountsRenewCredentials(ctx context.Context, id NetAppAccountId) (result AccountsRenewCredentialsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/renewCredentials", 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 -} - -// AccountsRenewCredentialsThenPoll performs AccountsRenewCredentials then polls until it's completed -func (c NetAppAccountsClient) AccountsRenewCredentialsThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsRenewCredentials(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsRenewCredentials: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsRenewCredentials: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsupdate.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsupdate.go deleted file mode 100644 index 14d063ae23d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/method_accountsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsUpdate ... -func (c NetAppAccountsClient) AccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (result AccountsUpdateOperationResponse, 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 -} - -// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) error { - result, err := c.AccountsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountencryption.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountencryption.go deleted file mode 100644 index 93f1a662f77..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountencryption.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryption struct { - Identity *EncryptionIdentity `json:"identity,omitempty"` - KeySource *KeySource `json:"keySource,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountproperties.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountproperties.go deleted file mode 100644 index 18428908f56..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_accountproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountProperties struct { - ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` - DisableShowmount *bool `json:"disableShowmount,omitempty"` - Encryption *AccountEncryption `json:"encryption,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_activedirectory.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_activedirectory.go deleted file mode 100644 index 81bbf0d2927..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_activedirectory.go +++ /dev/null @@ -1,30 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ActiveDirectory struct { - ActiveDirectoryId *string `json:"activeDirectoryId,omitempty"` - AdName *string `json:"adName,omitempty"` - Administrators *[]string `json:"administrators,omitempty"` - AesEncryption *bool `json:"aesEncryption,omitempty"` - AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` - BackupOperators *[]string `json:"backupOperators,omitempty"` - Dns *string `json:"dns,omitempty"` - Domain *string `json:"domain,omitempty"` - EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` - KdcIP *string `json:"kdcIP,omitempty"` - LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` - LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` - LdapSigning *bool `json:"ldapSigning,omitempty"` - OrganizationalUnit *string `json:"organizationalUnit,omitempty"` - Password *string `json:"password,omitempty"` - PreferredServersForLdapClient *string `json:"preferredServersForLdapClient,omitempty"` - SecurityOperators *[]string `json:"securityOperators,omitempty"` - ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` - Site *string `json:"site,omitempty"` - SmbServerName *string `json:"smbServerName,omitempty"` - Status *ActiveDirectoryStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - Username *string `json:"username,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_encryptionidentity.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_encryptionidentity.go deleted file mode 100644 index 50cf4dbf679..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_encryptionidentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncryptionIdentity struct { - PrincipalId *string `json:"principalId,omitempty"` - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_keyvaultproperties.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_keyvaultproperties.go deleted file mode 100644 index ac5d8c6afa4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_keyvaultproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KeyVaultProperties struct { - KeyName string `json:"keyName"` - KeyVaultId *string `json:"keyVaultId,omitempty"` - KeyVaultResourceId string `json:"keyVaultResourceId"` - KeyVaultUri string `json:"keyVaultUri"` - Status *KeyVaultStatus `json:"status,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_ldapsearchscopeopt.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_ldapsearchscopeopt.go deleted file mode 100644 index c476b0f0875..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_ldapsearchscopeopt.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LdapSearchScopeOpt struct { - GroupDN *string `json:"groupDN,omitempty"` - GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` - UserDN *string `json:"userDN,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccount.go deleted file mode 100644 index ae38663e126..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccount.go +++ /dev/null @@ -1,21 +0,0 @@ -package netappaccounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccount struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccountpatch.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccountpatch.go deleted file mode 100644 index 9f24bca3d5a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/model_netappaccountpatch.go +++ /dev/null @@ -1,18 +0,0 @@ -package netappaccounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountPatch struct { - Id *string `json:"id,omitempty"` - Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/predicates.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/predicates.go deleted file mode 100644 index ad2c0a55483..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p NetAppAccountOperationPredicate) Matches(input NetAppAccount) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappaccounts/version.go b/resource-manager/netapp/2022-11-01-preview/netappaccounts/version.go deleted file mode 100644 index 05b77d5c1ee..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappaccounts/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappaccounts/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/README.md b/resource-manager/netapp/2022-11-01-preview/netappresource/README.md deleted file mode 100644 index 23ef9b9b188..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/README.md +++ /dev/null @@ -1,131 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/netappresource` Documentation - -The `netappresource` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/netappresource" -``` - - -### Client Initialization - -```go -client := netappresource.NewNetAppResourceClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppResourceClient.CheckFilePathAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.FilePathAvailabilityRequest{ - // ... -} - - -read, err := client.CheckFilePathAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckNameAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.ResourceNameAvailabilityRequest{ - // ... -} - - -read, err := client.CheckNameAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckQuotaAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.QuotaAvailabilityRequest{ - // ... -} - - -read, err := client.CheckQuotaAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QueryRegionInfo` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QueryRegionInfo(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsGet` - -```go -ctx := context.TODO() -id := netappresource.NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - -read, err := client.QuotaLimitsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsList` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QuotaLimitsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/client.go b/resource-manager/netapp/2022-11-01-preview/netappresource/client.go deleted file mode 100644 index e02988617d8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappresource - -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 NetAppResourceClient struct { - Client *resourcemanager.Client -} - -func NewNetAppResourceClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppResourceClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappresource", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) - } - - return &NetAppResourceClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/constants.go b/resource-manager/netapp/2022-11-01-preview/netappresource/constants.go deleted file mode 100644 index c87183e60b6..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/constants.go +++ /dev/null @@ -1,204 +0,0 @@ -package netappresource - -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 CheckNameResourceTypes string - -const ( - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckNameResourceTypes() []string { - return []string{ - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckNameResourceTypes(input string) (*CheckNameResourceTypes, error) { - vals := map[string]CheckNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckNameResourceTypes(input) - return &out, nil -} - -type CheckQuotaNameResourceTypes string - -const ( - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckQuotaNameResourceTypes() []string { - return []string{ - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckQuotaNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckQuotaNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckQuotaNameResourceTypes(input string) (*CheckQuotaNameResourceTypes, error) { - vals := map[string]CheckQuotaNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckQuotaNameResourceTypes(input) - return &out, nil -} - -type InAvailabilityReasonType string - -const ( - InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" - InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" -) - -func PossibleValuesForInAvailabilityReasonType() []string { - return []string{ - string(InAvailabilityReasonTypeAlreadyExists), - string(InAvailabilityReasonTypeInvalid), - } -} - -func (s *InAvailabilityReasonType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseInAvailabilityReasonType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseInAvailabilityReasonType(input string) (*InAvailabilityReasonType, error) { - vals := map[string]InAvailabilityReasonType{ - "alreadyexists": InAvailabilityReasonTypeAlreadyExists, - "invalid": InAvailabilityReasonTypeInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InAvailabilityReasonType(input) - return &out, nil -} - -type RegionStorageToNetworkProximity string - -const ( - RegionStorageToNetworkProximityAcrossTTwo RegionStorageToNetworkProximity = "AcrossT2" - RegionStorageToNetworkProximityDefault RegionStorageToNetworkProximity = "Default" - RegionStorageToNetworkProximityTOne RegionStorageToNetworkProximity = "T1" - RegionStorageToNetworkProximityTOneAndAcrossTTwo RegionStorageToNetworkProximity = "T1AndAcrossT2" - RegionStorageToNetworkProximityTOneAndTTwo RegionStorageToNetworkProximity = "T1AndT2" - RegionStorageToNetworkProximityTOneAndTTwoAndAcrossTTwo RegionStorageToNetworkProximity = "T1AndT2AndAcrossT2" - RegionStorageToNetworkProximityTTwo RegionStorageToNetworkProximity = "T2" - RegionStorageToNetworkProximityTTwoAndAcrossTTwo RegionStorageToNetworkProximity = "T2AndAcrossT2" -) - -func PossibleValuesForRegionStorageToNetworkProximity() []string { - return []string{ - string(RegionStorageToNetworkProximityAcrossTTwo), - string(RegionStorageToNetworkProximityDefault), - string(RegionStorageToNetworkProximityTOne), - string(RegionStorageToNetworkProximityTOneAndAcrossTTwo), - string(RegionStorageToNetworkProximityTOneAndTTwo), - string(RegionStorageToNetworkProximityTOneAndTTwoAndAcrossTTwo), - string(RegionStorageToNetworkProximityTTwo), - string(RegionStorageToNetworkProximityTTwoAndAcrossTTwo), - } -} - -func (s *RegionStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRegionStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRegionStorageToNetworkProximity(input string) (*RegionStorageToNetworkProximity, error) { - vals := map[string]RegionStorageToNetworkProximity{ - "acrosst2": RegionStorageToNetworkProximityAcrossTTwo, - "default": RegionStorageToNetworkProximityDefault, - "t1": RegionStorageToNetworkProximityTOne, - "t1andacrosst2": RegionStorageToNetworkProximityTOneAndAcrossTTwo, - "t1andt2": RegionStorageToNetworkProximityTOneAndTTwo, - "t1andt2andacrosst2": RegionStorageToNetworkProximityTOneAndTTwoAndAcrossTTwo, - "t2": RegionStorageToNetworkProximityTTwo, - "t2andacrosst2": RegionStorageToNetworkProximityTTwoAndAcrossTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RegionStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go b/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go deleted file mode 100644 index 7c120e2a191..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/id_location.go +++ /dev/null @@ -1,116 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - LocationName string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, locationName string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - return nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(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 := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/id_location_test.go b/resource-manager/netapp/2022-11-01-preview/netappresource/id_location_test.go deleted file mode 100644 index 37beb10bbc3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/id_location_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -func TestNewLocationID(t *testing.T) { - id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } -} - -func TestFormatLocationID(t *testing.T) { - actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseLocationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestParseLocationIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestSegmentsForLocationId(t *testing.T) { - segments := LocationId{}.Segments() - if len(segments) == 0 { - t.Fatalf("LocationId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go deleted file mode 100644 index aa29f073d5d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -// QuotaLimitId is a struct representing the Resource ID for a Quota Limit -type QuotaLimitId struct { - SubscriptionId string - LocationName string - QuotaLimitName string -} - -// NewQuotaLimitID returns a new QuotaLimitId struct -func NewQuotaLimitID(subscriptionId string, locationName string, quotaLimitName string) QuotaLimitId { - return QuotaLimitId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - QuotaLimitName: quotaLimitName, - } -} - -// ParseQuotaLimitID parses 'input' into a QuotaLimitId -func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseQuotaLimitIDInsensitively parses 'input' case-insensitively into a QuotaLimitId -// note: this method should only be used for API response data and not user input -func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) - } - - return nil -} - -// ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID -func ValidateQuotaLimitID(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 := ParseQuotaLimitID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Quota Limit ID -func (id QuotaLimitId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s/quotaLimits/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.QuotaLimitName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Quota Limit ID -func (id QuotaLimitId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - resourceids.StaticSegment("staticQuotaLimits", "quotaLimits", "quotaLimits"), - resourceids.UserSpecifiedSegment("quotaLimitName", "quotaLimitValue"), - } -} - -// String returns a human-readable description of this Quota Limit ID -func (id QuotaLimitId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - fmt.Sprintf("Quota Limit Name: %q", id.QuotaLimitName), - } - return fmt.Sprintf("Quota Limit (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit_test.go b/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit_test.go deleted file mode 100644 index ca3050d8d70..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/id_quotalimit_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -func TestNewQuotaLimitID(t *testing.T) { - id := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } - - if id.QuotaLimitName != "quotaLimitValue" { - t.Fatalf("Expected %q but got %q for Segment 'QuotaLimitName'", id.QuotaLimitName, "quotaLimitValue") - } -} - -func TestFormatQuotaLimitID(t *testing.T) { - actual := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseQuotaLimitID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestParseQuotaLimitIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - QuotaLimitName: "qUoTaLiMiTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestSegmentsForQuotaLimitId(t *testing.T) { - segments := QuotaLimitId{}.Segments() - if len(segments) == 0 { - t.Fatalf("QuotaLimitId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/method_checkfilepathavailability.go b/resource-manager/netapp/2022-11-01-preview/netappresource/method_checkfilepathavailability.go deleted file mode 100644 index ccaafd95a81..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/method_checkfilepathavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckFilePathAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckFilePathAvailability ... -func (c NetAppResourceClient) CheckFilePathAvailability(ctx context.Context, id LocationId, input FilePathAvailabilityRequest) (result CheckFilePathAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkFilePathAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/method_checknameavailability.go b/resource-manager/netapp/2022-11-01-preview/netappresource/method_checknameavailability.go deleted file mode 100644 index 277efaba606..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/method_checknameavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckNameAvailability ... -func (c NetAppResourceClient) CheckNameAvailability(ctx context.Context, id LocationId, input ResourceNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkNameAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/method_checkquotaavailability.go b/resource-manager/netapp/2022-11-01-preview/netappresource/method_checkquotaavailability.go deleted file mode 100644 index e332f8c761b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/method_checkquotaavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckQuotaAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckQuotaAvailability ... -func (c NetAppResourceClient) CheckQuotaAvailability(ctx context.Context, id LocationId, input QuotaAvailabilityRequest) (result CheckQuotaAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkQuotaAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/method_queryregioninfo.go b/resource-manager/netapp/2022-11-01-preview/netappresource/method_queryregioninfo.go deleted file mode 100644 index bce1ced7640..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/method_queryregioninfo.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QueryRegionInfoOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RegionInfo -} - -// QueryRegionInfo ... -func (c NetAppResourceClient) QueryRegionInfo(ctx context.Context, id LocationId) (result QueryRegionInfoOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/regionInfo", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitsget.go b/resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitsget.go deleted file mode 100644 index 2b566bfa762..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappresource - -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 QuotaLimitsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItem -} - -// QuotaLimitsGet ... -func (c NetAppResourceClient) QuotaLimitsGet(ctx context.Context, id QuotaLimitId) (result QuotaLimitsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitslist.go b/resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitslist.go deleted file mode 100644 index e7dcec4cc4e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/method_quotalimitslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QuotaLimitsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItemList -} - -// QuotaLimitsList ... -func (c NetAppResourceClient) QuotaLimitsList(ctx context.Context, id LocationId) (result QuotaLimitsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/quotaLimits", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_checkavailabilityresponse.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_checkavailabilityresponse.go deleted file mode 100644 index 6423d9de076..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_checkavailabilityresponse.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckAvailabilityResponse struct { - IsAvailable *bool `json:"isAvailable,omitempty"` - Message *string `json:"message,omitempty"` - Reason *InAvailabilityReasonType `json:"reason,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_filepathavailabilityrequest.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_filepathavailabilityrequest.go deleted file mode 100644 index 6407d29060b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_filepathavailabilityrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilePathAvailabilityRequest struct { - Name string `json:"name"` - SubnetId string `json:"subnetId"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_quotaavailabilityrequest.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_quotaavailabilityrequest.go deleted file mode 100644 index d8df9ac4cef..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_quotaavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type QuotaAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckQuotaNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfo.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfo.go deleted file mode 100644 index 63c92a72c98..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfo struct { - AvailabilityZoneMappings *[]RegionInfoAvailabilityZoneMappingsInlined `json:"availabilityZoneMappings,omitempty"` - StorageToNetworkProximity *RegionStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfoavailabilityzonemappingsinlined.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfoavailabilityzonemappingsinlined.go deleted file mode 100644 index 36fce7489dc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_regioninfoavailabilityzonemappingsinlined.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfoAvailabilityZoneMappingsInlined struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - IsAvailable *bool `json:"isAvailable,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_resourcenameavailabilityrequest.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_resourcenameavailabilityrequest.go deleted file mode 100644 index 0bfbaf4c0e9..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_resourcenameavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ResourceNameAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitem.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitem.go deleted file mode 100644 index 88a5cbd39c1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitem.go +++ /dev/null @@ -1,16 +0,0 @@ -package netappresource - -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 SubscriptionQuotaItem struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubscriptionQuotaItemProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemlist.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemlist.go deleted file mode 100644 index 800319869a1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemlist.go +++ /dev/null @@ -1,8 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemList struct { - Value *[]SubscriptionQuotaItem `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemproperties.go b/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemproperties.go deleted file mode 100644 index 01cdd538c05..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/model_subscriptionquotaitemproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemProperties struct { - Current *int64 `json:"current,omitempty"` - Default *int64 `json:"default,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/netappresource/version.go b/resource-manager/netapp/2022-11-01-preview/netappresource/version.go deleted file mode 100644 index 51e72904a85..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/netappresource/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappresource - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappresource/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/README.md b/resource-manager/netapp/2022-11-01-preview/poolchange/README.md deleted file mode 100644 index b1833c734be..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/poolchange` Documentation - -The `poolchange` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/poolchange" -``` - - -### Client Initialization - -```go -client := poolchange.NewPoolChangeClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `PoolChangeClient.VolumesPoolChange` - -```go -ctx := context.TODO() -id := poolchange.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := poolchange.PoolChangeRequest{ - // ... -} - - -if err := client.VolumesPoolChangeThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/client.go b/resource-manager/netapp/2022-11-01-preview/poolchange/client.go deleted file mode 100644 index 270c25028c2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package poolchange - -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 PoolChangeClient struct { - Client *resourcemanager.Client -} - -func NewPoolChangeClientWithBaseURI(sdkApi sdkEnv.Api) (*PoolChangeClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "poolchange", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) - } - - return &PoolChangeClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go b/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go deleted file mode 100644 index 60065ac10ae..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package poolchange - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume_test.go deleted file mode 100644 index 496e8bbcaad..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package poolchange - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/method_volumespoolchange.go b/resource-manager/netapp/2022-11-01-preview/poolchange/method_volumespoolchange.go deleted file mode 100644 index 7a0ca0e6450..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/method_volumespoolchange.go +++ /dev/null @@ -1,74 +0,0 @@ -package poolchange - -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 VolumesPoolChangeOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesPoolChange ... -func (c PoolChangeClient) VolumesPoolChange(ctx context.Context, id VolumeId, input PoolChangeRequest) (result VolumesPoolChangeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/poolChange", 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 -} - -// VolumesPoolChangeThenPoll performs VolumesPoolChange then polls until it's completed -func (c PoolChangeClient) VolumesPoolChangeThenPoll(ctx context.Context, id VolumeId, input PoolChangeRequest) error { - result, err := c.VolumesPoolChange(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesPoolChange: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesPoolChange: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/model_poolchangerequest.go b/resource-manager/netapp/2022-11-01-preview/poolchange/model_poolchangerequest.go deleted file mode 100644 index 19402a5b699..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/model_poolchangerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package poolchange - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolChangeRequest struct { - NewPoolResourceId string `json:"newPoolResourceId"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/poolchange/version.go b/resource-manager/netapp/2022-11-01-preview/poolchange/version.go deleted file mode 100644 index 93421af5b36..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/poolchange/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package poolchange - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/poolchange/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/client.go b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/client.go deleted file mode 100644 index 2d17ccc3976..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package resetcifspassword - -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 ResetCifsPasswordClient struct { - Client *resourcemanager.Client -} - -func NewResetCifsPasswordClientWithBaseURI(sdkApi sdkEnv.Api) (*ResetCifsPasswordClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "resetcifspassword", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) - } - - return &ResetCifsPasswordClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go deleted file mode 100644 index 69421cfe5d9..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package resetcifspassword - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume_test.go deleted file mode 100644 index 9b41608cce7..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package resetcifspassword - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/method_volumesresetcifspassword.go b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/method_volumesresetcifspassword.go deleted file mode 100644 index ca6d379fdfc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/method_volumesresetcifspassword.go +++ /dev/null @@ -1,70 +0,0 @@ -package resetcifspassword - -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 VolumesResetCifsPasswordOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResetCifsPassword ... -func (c ResetCifsPasswordClient) VolumesResetCifsPassword(ctx context.Context, id VolumeId) (result VolumesResetCifsPasswordOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resetCifsPassword", 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 -} - -// VolumesResetCifsPasswordThenPoll performs VolumesResetCifsPassword then polls until it's completed -func (c ResetCifsPasswordClient) VolumesResetCifsPasswordThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResetCifsPassword(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResetCifsPassword: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResetCifsPassword: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/version.go b/resource-manager/netapp/2022-11-01-preview/resetcifspassword/version.go deleted file mode 100644 index 43e7e04ce0c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/resetcifspassword/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package resetcifspassword - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/resetcifspassword/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/restore/README.md b/resource-manager/netapp/2022-11-01-preview/restore/README.md deleted file mode 100644 index 6d7a8bb225a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/restore` Documentation - -The `restore` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/restore" -``` - - -### Client Initialization - -```go -client := restore.NewRestoreClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `RestoreClient.BackupsGetVolumeRestoreStatus` - -```go -ctx := context.TODO() -id := restore.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.BackupsGetVolumeRestoreStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/restore/client.go b/resource-manager/netapp/2022-11-01-preview/restore/client.go deleted file mode 100644 index 97fa355d7db..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package restore - -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 RestoreClient struct { - Client *resourcemanager.Client -} - -func NewRestoreClientWithBaseURI(sdkApi sdkEnv.Api) (*RestoreClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "restore", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) - } - - return &RestoreClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/restore/constants.go b/resource-manager/netapp/2022-11-01-preview/restore/constants.go deleted file mode 100644 index 9eea259cd41..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/constants.go +++ /dev/null @@ -1,95 +0,0 @@ -package restore - -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 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go b/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go deleted file mode 100644 index 46089747e17..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package restore - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/restore/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/restore/id_volume_test.go deleted file mode 100644 index 2f07b6ef48e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package restore - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/restore/method_backupsgetvolumerestorestatus.go b/resource-manager/netapp/2022-11-01-preview/restore/method_backupsgetvolumerestorestatus.go deleted file mode 100644 index 47f85cfa0ce..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/method_backupsgetvolumerestorestatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package restore - -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 BackupsGetVolumeRestoreStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RestoreStatus -} - -// BackupsGetVolumeRestoreStatus ... -func (c RestoreClient) BackupsGetVolumeRestoreStatus(ctx context.Context, id VolumeId) (result BackupsGetVolumeRestoreStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/restoreStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/restore/model_restorestatus.go b/resource-manager/netapp/2022-11-01-preview/restore/model_restorestatus.go deleted file mode 100644 index 546d31e9ce7..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/model_restorestatus.go +++ /dev/null @@ -1,13 +0,0 @@ -package restore - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/restore/version.go b/resource-manager/netapp/2022-11-01-preview/restore/version.go deleted file mode 100644 index 87d6746445d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/restore/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package restore - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/restore/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/README.md b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/README.md deleted file mode 100644 index 53e7fa61872..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/README.md +++ /dev/null @@ -1,102 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/snapshotpolicy` Documentation - -The `snapshotpolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/snapshotpolicy" -``` - - -### Client Initialization - -```go -client := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesCreate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicy{ - // ... -} - - -read, err := client.SnapshotPoliciesCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesDelete` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesGet` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesList` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.SnapshotPoliciesList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesUpdate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicyPatch{ - // ... -} - - -if err := client.SnapshotPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/client.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/client.go deleted file mode 100644 index eebb8c7b8da..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicy - -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 SnapshotPolicyClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) - } - - return &SnapshotPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go deleted file mode 100644 index 162b7094379..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount_test.go deleted file mode 100644 index c181f6cd7cd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go deleted file mode 100644 index 3daea71a654..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy_test.go deleted file mode 100644 index b3f070cc0f2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciescreate.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciescreate.go deleted file mode 100644 index 8a1724f9e0d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciescreate.go +++ /dev/null @@ -1,56 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesCreateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesCreate ... -func (c SnapshotPolicyClient) SnapshotPoliciesCreate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicy) (result SnapshotPoliciesCreateOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesdelete.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesdelete.go deleted file mode 100644 index 88822a15bf8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesDelete ... -func (c SnapshotPolicyClient) SnapshotPoliciesDelete(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesDeleteOperationResponse, 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 -} - -// SnapshotPoliciesDeleteThenPoll performs SnapshotPoliciesDelete then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesDeleteThenPoll(ctx context.Context, id SnapshotPolicyId) error { - result, err := c.SnapshotPoliciesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesget.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesget.go deleted file mode 100644 index ebb812f1ffb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesGet ... -func (c SnapshotPolicyClient) SnapshotPoliciesGet(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpolicieslist.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpolicieslist.go deleted file mode 100644 index bec4c8146b3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPoliciesList -} - -// SnapshotPoliciesList ... -func (c SnapshotPolicyClient) SnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (result SnapshotPoliciesListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshotPolicies", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesupdate.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesupdate.go deleted file mode 100644 index 46bf5bd6f56..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/method_snapshotpoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesUpdate ... -func (c SnapshotPolicyClient) SnapshotPoliciesUpdate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) (result SnapshotPoliciesUpdateOperationResponse, 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 -} - -// SnapshotPoliciesUpdateThenPoll performs SnapshotPoliciesUpdate then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesUpdateThenPoll(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) error { - result, err := c.SnapshotPoliciesUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_dailyschedule.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_dailyschedule.go deleted file mode 100644 index bdafb72e6e0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_dailyschedule.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DailySchedule struct { - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_hourlyschedule.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_hourlyschedule.go deleted file mode 100644 index a1e5d0fa028..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_hourlyschedule.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type HourlySchedule struct { - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_monthlyschedule.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_monthlyschedule.go deleted file mode 100644 index 02cbcad6a59..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_monthlyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MonthlySchedule struct { - DaysOfMonth *string `json:"daysOfMonth,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicieslist.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicieslist.go deleted file mode 100644 index 910e2519adb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPoliciesList struct { - Value *[]SnapshotPolicy `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicy.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicy.go deleted file mode 100644 index 310cfaaf1bb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -package snapshotpolicy - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicy struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties SnapshotPolicyProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicypatch.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicypatch.go deleted file mode 100644 index 76df9be172b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SnapshotPolicyProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicyproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicyproperties.go deleted file mode 100644 index fb4fb0fcb05..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_snapshotpolicyproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyProperties struct { - DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` - MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_weeklyschedule.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_weeklyschedule.go deleted file mode 100644 index 128ece7ef5e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/model_weeklyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type WeeklySchedule struct { - Day *string `json:"day,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/version.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/version.go deleted file mode 100644 index e7a39c00bf7..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/README.md b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/README.md deleted file mode 100644 index a4b1f8cc5ea..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes` Documentation - -The `snapshotpolicylistvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/snapshotpolicylistvolumes" -``` - - -### Client Initialization - -```go -client := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyListVolumesClient.SnapshotPoliciesListVolumes` - -```go -ctx := context.TODO() -id := snapshotpolicylistvolumes.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesListVolumes(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/client.go deleted file mode 100644 index 047d79a12c3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPolicyListVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicylistvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) - } - - return &SnapshotPolicyListVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/constants.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/constants.go deleted file mode 100644 index 1a0d5a1a245..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/constants.go +++ /dev/null @@ -1,558 +0,0 @@ -package snapshotpolicylistvolumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityAcrossTTwo VolumeStorageToNetworkProximity = "AcrossT2" - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityAcrossTTwo), - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "acrosst2": VolumeStorageToNetworkProximityAcrossTTwo, - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go deleted file mode 100644 index 37d159192cf..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy_test.go deleted file mode 100644 index b7b4ebfa73a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go deleted file mode 100644 index 95000d4db93..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPoliciesListVolumesOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicyVolumeList -} - -// SnapshotPoliciesListVolumes ... -func (c SnapshotPolicyListVolumesClient) SnapshotPoliciesListVolumes(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesListVolumesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_exportpolicyrule.go deleted file mode 100644 index dd6bb7a20fc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_mounttargetproperties.go deleted file mode 100644 index 49f9f6f131a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 0d5756a7089..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_replicationobject.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_replicationobject.go deleted file mode 100644 index 97bf50ea504..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go deleted file mode 100644 index 2d14e9596fe..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyVolumeList struct { - Value *[]Volume `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volume.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volume.go deleted file mode 100644 index 36417f52891..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumebackupproperties.go deleted file mode 100644 index bb13b1c3e66..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumebackupproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - BackupVaultId *string `json:"backupVaultId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumeproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumeproperties.go deleted file mode 100644 index 309c5236d2a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumeproperties.go +++ /dev/null @@ -1,60 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - ActualThroughputMibps *float64 `json:"actualThroughputMibps,omitempty"` - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - OriginatingResourceId *string `json:"originatingResourceId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index bf5ff10761d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` - VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 1ad178d6e25..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumerelocationproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumerelocationproperties.go deleted file mode 100644 index 26ffc8f0697..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumesnapshotproperties.go deleted file mode 100644 index e4915375144..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/version.go b/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/version.go deleted file mode 100644 index 9edb2249b4a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshotpolicylistvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicylistvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/README.md b/resource-manager/netapp/2022-11-01-preview/snapshots/README.md deleted file mode 100644 index c4707c32273..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/snapshots` Documentation - -The `snapshots` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/snapshots" -``` - - -### Client Initialization - -```go -client := snapshots.NewSnapshotsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotsClient.Create` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.Snapshot{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Delete` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Get` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.List` - -```go -ctx := context.TODO() -id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.RestoreFiles` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.SnapshotRestoreFiles{ - // ... -} - - -if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Update` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") -var payload interface{} - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/client.go b/resource-manager/netapp/2022-11-01-preview/snapshots/client.go deleted file mode 100644 index 620b7900eab..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshots - -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 SnapshotsClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) - } - - return &SnapshotsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go b/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go deleted file mode 100644 index 8a20d21ec27..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot.go +++ /dev/null @@ -1,152 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -// SnapshotId is a struct representing the Resource ID for a Snapshot -type SnapshotId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SnapshotName string -} - -// NewSnapshotID returns a new SnapshotId struct -func NewSnapshotID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, snapshotName string) SnapshotId { - return SnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SnapshotName: snapshotName, - } -} - -// ParseSnapshotID parses 'input' into a SnapshotId -func ParseSnapshotID(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotIDInsensitively parses 'input' case-insensitively into a SnapshotId -// note: this method should only be used for API response data and not user input -func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotId) 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) - } - - if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) - } - - return nil -} - -// ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID -func ValidateSnapshotID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSnapshotID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot ID -func (id SnapshotId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SnapshotName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot ID -func (id SnapshotId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), - resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), - } -} - -// String returns a human-readable description of this Snapshot ID -func (id SnapshotId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), - } - return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot_test.go b/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot_test.go deleted file mode 100644 index 4dd0b44f4a3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/id_snapshot_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -func TestNewSnapshotID(t *testing.T) { - id := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SnapshotName != "snapshotValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotName'", id.SnapshotName, "snapshotValue") - } -} - -func TestFormatSnapshotID(t *testing.T) { - actual := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestParseSnapshotIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SnapshotName: "sNaPsHoTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestSegmentsForSnapshotId(t *testing.T) { - segments := SnapshotId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go b/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go deleted file mode 100644 index 06879ea6a3a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume_test.go deleted file mode 100644 index 6bcb01d8ea1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/method_create.go b/resource-manager/netapp/2022-11-01-preview/snapshots/method_create.go deleted file mode 100644 index 1c781284afe..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Create ... -func (c SnapshotsClient) Create(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusCreated, - }, - 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 SnapshotsClient) CreateThenPoll(ctx context.Context, id SnapshotId, input Snapshot) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/method_delete.go b/resource-manager/netapp/2022-11-01-preview/snapshots/method_delete.go deleted file mode 100644 index ef16480f860..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SnapshotsClient) DeleteThenPoll(ctx context.Context, id SnapshotId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/method_get.go b/resource-manager/netapp/2022-11-01-preview/snapshots/method_get.go deleted file mode 100644 index 4f024ded473..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/method_list.go b/resource-manager/netapp/2022-11-01-preview/snapshots/method_list.go deleted file mode 100644 index f1079759c22..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotsList -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshots", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/method_restorefiles.go b/resource-manager/netapp/2022-11-01-preview/snapshots/method_restorefiles.go deleted file mode 100644 index 685be44a5ff..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/method_restorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 RestoreFilesOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// RestoreFiles ... -func (c SnapshotsClient) RestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (result RestoreFilesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - 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 -} - -// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed -func (c SnapshotsClient) RestoreFilesThenPoll(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) error { - result, err := c.RestoreFiles(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RestoreFiles: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after RestoreFiles: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/method_update.go b/resource-manager/netapp/2022-11-01-preview/snapshots/method_update.go deleted file mode 100644 index 656719e61bd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Update ... -func (c SnapshotsClient) Update(ctx context.Context, id SnapshotId, input interface{}) (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 SnapshotsClient) UpdateThenPoll(ctx context.Context, id SnapshotId, input interface{}) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshot.go b/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshot.go deleted file mode 100644 index fe53e779a4c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshot.go +++ /dev/null @@ -1,17 +0,0 @@ -package snapshots - -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 Snapshot struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *SnapshotProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotproperties.go b/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotproperties.go deleted file mode 100644 index fe60537eaaa..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotproperties.go +++ /dev/null @@ -1,28 +0,0 @@ -package snapshots - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotProperties struct { - Created *string `json:"created,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` -} - -func (o *SnapshotProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *SnapshotProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotrestorefiles.go b/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotrestorefiles.go deleted file mode 100644 index de80d971dcf..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotrestorefiles.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotRestoreFiles struct { - DestinationPath *string `json:"destinationPath,omitempty"` - FilePaths []string `json:"filePaths"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotslist.go b/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotslist.go deleted file mode 100644 index bf283b0d2ac..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/model_snapshotslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotsList struct { - Value *[]Snapshot `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/snapshots/version.go b/resource-manager/netapp/2022-11-01-preview/snapshots/version.go deleted file mode 100644 index 6a25f890373..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/snapshots/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshots - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshots/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/README.md b/resource-manager/netapp/2022-11-01-preview/subvolumes/README.md deleted file mode 100644 index 7c19dce6abc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/subvolumes` Documentation - -The `subvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/subvolumes" -``` - - -### Client Initialization - -```go -client := subvolumes.NewSubVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SubVolumesClient.Create` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumeInfo{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Delete` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Get` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -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: `SubVolumesClient.GetMetadata` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.GetMetadataThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.ListByVolume` - -```go -ctx := context.TODO() -id := subvolumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -// alternatively `client.ListByVolume(ctx, id)` can be used to do batched pagination -items, err := client.ListByVolumeComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `SubVolumesClient.Update` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumePatchRequest{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/client.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/client.go deleted file mode 100644 index b675258d906..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package subvolumes - -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 SubVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSubVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SubVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "subvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) - } - - return &SubVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go deleted file mode 100644 index 0649b6aeac0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume.go +++ /dev/null @@ -1,152 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -// SubVolumeId is a struct representing the Resource ID for a Sub Volume -type SubVolumeId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SubVolumeName string -} - -// NewSubVolumeID returns a new SubVolumeId struct -func NewSubVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, subVolumeName string) SubVolumeId { - return SubVolumeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SubVolumeName: subVolumeName, - } -} - -// ParseSubVolumeID parses 'input' into a SubVolumeId -func ParseSubVolumeID(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSubVolumeIDInsensitively parses 'input' case-insensitively into a SubVolumeId -// note: this method should only be used for API response data and not user input -func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SubVolumeId) 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) - } - - if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) - } - - return nil -} - -// ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID -func ValidateSubVolumeID(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 := ParseSubVolumeID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Sub Volume ID -func (id SubVolumeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/subVolumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SubVolumeName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Sub Volume ID -func (id SubVolumeId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSubVolumes", "subVolumes", "subVolumes"), - resourceids.UserSpecifiedSegment("subVolumeName", "subVolumeValue"), - } -} - -// String returns a human-readable description of this Sub Volume ID -func (id SubVolumeId) 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), - fmt.Sprintf("Sub Volume Name: %q", id.SubVolumeName), - } - return fmt.Sprintf("Sub Volume (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume_test.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume_test.go deleted file mode 100644 index f76df7c9c16..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_subvolume_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -func TestNewSubVolumeID(t *testing.T) { - id := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SubVolumeName != "subVolumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'SubVolumeName'", id.SubVolumeName, "subVolumeValue") - } -} - -func TestFormatSubVolumeID(t *testing.T) { - actual := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestParseSubVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SubVolumeName: "sUbVoLuMeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestSegmentsForSubVolumeId(t *testing.T) { - segments := SubVolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubVolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go deleted file mode 100644 index 8bbeb6c9e23..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume_test.go deleted file mode 100644 index 7d4f6c8d6f1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_create.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/method_create.go deleted file mode 100644 index 65a0d34e8d4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -package subvolumes - -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 -} - -// Create ... -func (c SubVolumesClient) Create(ctx context.Context, id SubVolumeId, input SubvolumeInfo) (result CreateOperationResponse, 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 -} - -// CreateThenPoll performs Create then polls until it's completed -func (c SubVolumesClient) CreateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumeInfo) 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/resource-manager/netapp/2022-11-01-preview/subvolumes/method_delete.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/method_delete.go deleted file mode 100644 index 2f19ed22f0c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubVolumesClient) Delete(ctx context.Context, id SubVolumeId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SubVolumesClient) DeleteThenPoll(ctx context.Context, id SubVolumeId) 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/resource-manager/netapp/2022-11-01-preview/subvolumes/method_get.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/method_get.go deleted file mode 100644 index 063628c3271..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package subvolumes - -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 *SubvolumeInfo -} - -// Get ... -func (c SubVolumesClient) Get(ctx context.Context, id SubVolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_getmetadata.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/method_getmetadata.go deleted file mode 100644 index a38be9004ef..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_getmetadata.go +++ /dev/null @@ -1,70 +0,0 @@ -package subvolumes - -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 GetMetadataOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// GetMetadata ... -func (c SubVolumesClient) GetMetadata(ctx context.Context, id SubVolumeId) (result GetMetadataOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/getMetadata", 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 -} - -// GetMetadataThenPoll performs GetMetadata then polls until it's completed -func (c SubVolumesClient) GetMetadataThenPoll(ctx context.Context, id SubVolumeId) error { - result, err := c.GetMetadata(ctx, id) - if err != nil { - return fmt.Errorf("performing GetMetadata: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after GetMetadata: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_listbyvolume.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/method_listbyvolume.go deleted file mode 100644 index 50bba7a698f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_listbyvolume.go +++ /dev/null @@ -1,89 +0,0 @@ -package subvolumes - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]SubvolumeInfo -} - -type ListByVolumeCompleteResult struct { - Items []SubvolumeInfo -} - -// ListByVolume ... -func (c SubVolumesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/subVolumes", 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 *[]SubvolumeInfo `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListByVolumeComplete retrieves all the results into a single object -func (c SubVolumesClient) ListByVolumeComplete(ctx context.Context, id VolumeId) (ListByVolumeCompleteResult, error) { - return c.ListByVolumeCompleteMatchingPredicate(ctx, id, SubvolumeInfoOperationPredicate{}) -} - -// ListByVolumeCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c SubVolumesClient) ListByVolumeCompleteMatchingPredicate(ctx context.Context, id VolumeId, predicate SubvolumeInfoOperationPredicate) (result ListByVolumeCompleteResult, err error) { - items := make([]SubvolumeInfo, 0) - - resp, err := c.ListByVolume(ctx, id) - if err != nil { - 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 = ListByVolumeCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_update.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/method_update.go deleted file mode 100644 index 919d2776e7f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package subvolumes - -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 -} - -// Update ... -func (c SubVolumesClient) Update(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) (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 SubVolumesClient) UpdateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) 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/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeinfo.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeinfo.go deleted file mode 100644 index 3adbcfc6002..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeinfo.go +++ /dev/null @@ -1,16 +0,0 @@ -package subvolumes - -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 SubvolumeInfo struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodel.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodel.go deleted file mode 100644 index d15828e2987..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodel.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeModelProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodelproperties.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodelproperties.go deleted file mode 100644 index 26911c386fc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumemodelproperties.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubvolumeModelProperties struct { - AccessedTimeStamp *string `json:"accessedTimeStamp,omitempty"` - BytesUsed *int64 `json:"bytesUsed,omitempty"` - ChangedTimeStamp *string `json:"changedTimeStamp,omitempty"` - CreationTimeStamp *string `json:"creationTimeStamp,omitempty"` - ModifiedTimeStamp *string `json:"modifiedTimeStamp,omitempty"` - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - Permissions *string `json:"permissions,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} - -func (o *SubvolumeModelProperties) GetAccessedTimeStampAsTime() (*time.Time, error) { - if o.AccessedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.AccessedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetAccessedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.AccessedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetChangedTimeStampAsTime() (*time.Time, error) { - if o.ChangedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ChangedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetChangedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ChangedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetCreationTimeStampAsTime() (*time.Time, error) { - if o.CreationTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreationTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetCreationTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreationTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetModifiedTimeStampAsTime() (*time.Time, error) { - if o.ModifiedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ModifiedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetModifiedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ModifiedTimeStamp = &formatted -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchparams.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchparams.go deleted file mode 100644 index 02ea94ff0ac..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchparams.go +++ /dev/null @@ -1,9 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchParams struct { - Path *string `json:"path,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchrequest.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchrequest.go deleted file mode 100644 index 0394a55073a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumepatchrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchRequest struct { - Properties *SubvolumePatchParams `json:"properties,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeproperties.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeproperties.go deleted file mode 100644 index 899e995183a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/model_subvolumeproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeProperties struct { - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/subvolumes/predicates.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/predicates.go deleted file mode 100644 index af649a6bd08..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeInfoOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p SubvolumeInfoOperationPredicate) Matches(input SubvolumeInfo) 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/resource-manager/netapp/2022-11-01-preview/subvolumes/version.go b/resource-manager/netapp/2022-11-01-preview/subvolumes/version.go deleted file mode 100644 index 0fac88c3a10..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/subvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package subvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/subvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/README.md b/resource-manager/netapp/2022-11-01-preview/volumegroups/README.md deleted file mode 100644 index 2fd01a763cd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/README.md +++ /dev/null @@ -1,81 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumegroups` Documentation - -The `volumegroups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/volumegroups" -``` - - -### Client Initialization - -```go -client := volumegroups.NewVolumeGroupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeGroupsClient.Create` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -payload := volumegroups.VolumeGroupDetails{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Delete` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Get` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -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: `VolumeGroupsClient.ListByNetAppAccount` - -```go -ctx := context.TODO() -id := volumegroups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.ListByNetAppAccount(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/client.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/client.go deleted file mode 100644 index a117e697f04..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient struct { - Client *resourcemanager.Client -} - -func NewVolumeGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeGroupsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumegroups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) - } - - return &VolumeGroupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/constants.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/constants.go deleted file mode 100644 index 316053ae00c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/constants.go +++ /dev/null @@ -1,596 +0,0 @@ -package volumegroups - -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 ApplicationType string - -const ( - ApplicationTypeSAPNegativeHANA ApplicationType = "SAP-HANA" -) - -func PossibleValuesForApplicationType() []string { - return []string{ - string(ApplicationTypeSAPNegativeHANA), - } -} - -func (s *ApplicationType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseApplicationType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseApplicationType(input string) (*ApplicationType, error) { - vals := map[string]ApplicationType{ - "sap-hana": ApplicationTypeSAPNegativeHANA, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ApplicationType(input) - return &out, nil -} - -type AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityAcrossTTwo VolumeStorageToNetworkProximity = "AcrossT2" - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityAcrossTTwo), - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "acrosst2": VolumeStorageToNetworkProximityAcrossTTwo, - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go deleted file mode 100644 index 180947b711b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount_test.go deleted file mode 100644 index 42d30d6c431..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go deleted file mode 100644 index f97a6bb10bd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -// VolumeGroupId is a struct representing the Resource ID for a Volume Group -type VolumeGroupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - VolumeGroupName string -} - -// NewVolumeGroupID returns a new VolumeGroupId struct -func NewVolumeGroupID(subscriptionId string, resourceGroupName string, netAppAccountName string, volumeGroupName string) VolumeGroupId { - return VolumeGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - VolumeGroupName: volumeGroupName, - } -} - -// ParseVolumeGroupID parses 'input' into a VolumeGroupId -func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeGroupIDInsensitively parses 'input' case-insensitively into a VolumeGroupId -// note: this method should only be used for API response data and not user input -func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeGroupId) 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.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) - } - - return nil -} - -// ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID -func ValidateVolumeGroupID(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 := ParseVolumeGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Group ID -func (id VolumeGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/volumeGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.VolumeGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Group ID -func (id VolumeGroupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticVolumeGroups", "volumeGroups", "volumeGroups"), - resourceids.UserSpecifiedSegment("volumeGroupName", "volumeGroupValue"), - } -} - -// String returns a human-readable description of this Volume Group ID -func (id VolumeGroupId) 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("Volume Group Name: %q", id.VolumeGroupName), - } - return fmt.Sprintf("Volume Group (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup_test.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup_test.go deleted file mode 100644 index d8c69411672..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/id_volumegroup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -func TestNewVolumeGroupID(t *testing.T) { - id := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.VolumeGroupName != "volumeGroupValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeGroupName'", id.VolumeGroupName, "volumeGroupValue") - } -} - -func TestFormatVolumeGroupID(t *testing.T) { - actual := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestParseVolumeGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - VolumeGroupName: "vOlUmEgRoUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestSegmentsForVolumeGroupId(t *testing.T) { - segments := VolumeGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/method_create.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/method_create.go deleted file mode 100644 index 13500e108f3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/method_create.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumegroups - -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 -} - -// Create ... -func (c VolumeGroupsClient) Create(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - }, - 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 VolumeGroupsClient) CreateThenPoll(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) 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/resource-manager/netapp/2022-11-01-preview/volumegroups/method_delete.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/method_delete.go deleted file mode 100644 index 32e6c75b150..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient) Delete(ctx context.Context, id VolumeGroupId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeGroupsClient) DeleteThenPoll(ctx context.Context, id VolumeGroupId) 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/resource-manager/netapp/2022-11-01-preview/volumegroups/method_get.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/method_get.go deleted file mode 100644 index 6a14cec40c4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumegroups - -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 *VolumeGroupDetails -} - -// Get ... -func (c VolumeGroupsClient) Get(ctx context.Context, id VolumeGroupId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/method_listbynetappaccount.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/method_listbynetappaccount.go deleted file mode 100644 index 0a84dcdd8e0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/method_listbynetappaccount.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumegroups - -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 *VolumeGroupList -} - -// ListByNetAppAccount ... -func (c VolumeGroupsClient) 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, - Path: fmt.Sprintf("%s/volumeGroups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_exportpolicyrule.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_exportpolicyrule.go deleted file mode 100644 index e17395ba1a7..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -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 ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_mounttargetproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_mounttargetproperties.go deleted file mode 100644 index 5844b80ce9d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -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 MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_placementkeyvaluepairs.go deleted file mode 100644 index 1714b1662a1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -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 PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_replicationobject.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_replicationobject.go deleted file mode 100644 index 6d145aa0079..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -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 ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumebackupproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumebackupproperties.go deleted file mode 100644 index 0cdc999f764..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumebackupproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -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 { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - BackupVaultId *string `json:"backupVaultId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroup.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroup.go deleted file mode 100644 index 5e4df7bb9c0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroup.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroup struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupListProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupdetails.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupdetails.go deleted file mode 100644 index 5f01af82c0f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupdetails.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupDetails struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplist.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplist.go deleted file mode 100644 index 447c6e6e858..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeGroupList struct { - Value *[]VolumeGroup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplistproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplistproperties.go deleted file mode 100644 index 5788ee516fc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegrouplistproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeGroupListProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupmetadata.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupmetadata.go deleted file mode 100644 index 30441c6826d..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupmetadata.go +++ /dev/null @@ -1,13 +0,0 @@ -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 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/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupproperties.go deleted file mode 100644 index 0bab153b397..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -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 VolumeGroupProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Volumes *[]VolumeGroupVolumeProperties `json:"volumes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupvolumeproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupvolumeproperties.go deleted file mode 100644 index 61bbdab9ce3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumegroupvolumeproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupVolumeProperties struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumeproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumeproperties.go deleted file mode 100644 index 7e5abcc724f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumeproperties.go +++ /dev/null @@ -1,60 +0,0 @@ -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 VolumeProperties struct { - ActualThroughputMibps *float64 `json:"actualThroughputMibps,omitempty"` - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - OriginatingResourceId *string `json:"originatingResourceId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesdataprotection.go deleted file mode 100644 index 632e45e64b0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -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 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/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 227c8586d6f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumerelocationproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumerelocationproperties.go deleted file mode 100644 index 4fea57c7396..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumesnapshotproperties.go deleted file mode 100644 index a3f5011da3b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumegroups/version.go b/resource-manager/netapp/2022-11-01-preview/volumegroups/version.go deleted file mode 100644 index 54f47939264..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumegroups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumegroups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumegroups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/README.md b/resource-manager/netapp/2022-11-01-preview/volumequotarules/README.md deleted file mode 100644 index 7a19f3ffb11..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumequotarules` Documentation - -The `volumequotarules` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/volumequotarules" -``` - - -### Client Initialization - -```go -client := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeQuotaRulesClient.Create` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRule{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Delete` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Get` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -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: `VolumeQuotaRulesClient.ListByVolume` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.ListByVolume(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Update` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRulePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/client.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/client.go deleted file mode 100644 index c6c70e112e0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient struct { - Client *resourcemanager.Client -} - -func NewVolumeQuotaRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeQuotaRulesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumequotarules", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) - } - - return &VolumeQuotaRulesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/constants.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/constants.go deleted file mode 100644 index fb0e41e1afb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/constants.go +++ /dev/null @@ -1,113 +0,0 @@ -package volumequotarules - -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 ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStatePatching ProvisioningState = "Patching" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateMoving), - string(ProvisioningStatePatching), - string(ProvisioningStateSucceeded), - } -} - -func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseProvisioningState(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "moving": ProvisioningStateMoving, - "patching": ProvisioningStatePatching, - "succeeded": ProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type Type string - -const ( - TypeDefaultGroupQuota Type = "DefaultGroupQuota" - TypeDefaultUserQuota Type = "DefaultUserQuota" - TypeIndividualGroupQuota Type = "IndividualGroupQuota" - TypeIndividualUserQuota Type = "IndividualUserQuota" -) - -func PossibleValuesForType() []string { - return []string{ - string(TypeDefaultGroupQuota), - string(TypeDefaultUserQuota), - string(TypeIndividualGroupQuota), - string(TypeIndividualUserQuota), - } -} - -func (s *Type) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseType(input string) (*Type, error) { - vals := map[string]Type{ - "defaultgroupquota": TypeDefaultGroupQuota, - "defaultuserquota": TypeDefaultUserQuota, - "individualgroupquota": TypeIndividualGroupQuota, - "individualuserquota": TypeIndividualUserQuota, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Type(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go deleted file mode 100644 index b3d6ab761b3..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume_test.go deleted file mode 100644 index 98a3bd4ff39..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go deleted file mode 100644 index 711a80ae5cd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule.go +++ /dev/null @@ -1,152 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -// VolumeQuotaRuleId is a struct representing the Resource ID for a Volume Quota Rule -type VolumeQuotaRuleId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - VolumeQuotaRuleName string -} - -// NewVolumeQuotaRuleID returns a new VolumeQuotaRuleId struct -func NewVolumeQuotaRuleID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, volumeQuotaRuleName string) VolumeQuotaRuleId { - return VolumeQuotaRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - VolumeQuotaRuleName: volumeQuotaRuleName, - } -} - -// ParseVolumeQuotaRuleID parses 'input' into a VolumeQuotaRuleId -func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeQuotaRuleIDInsensitively parses 'input' case-insensitively into a VolumeQuotaRuleId -// note: this method should only be used for API response data and not user input -func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeQuotaRuleId) 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) - } - - if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) - } - - return nil -} - -// ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID -func ValidateVolumeQuotaRuleID(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 := ParseVolumeQuotaRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Quota Rule ID -func (id VolumeQuotaRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/volumeQuotaRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.VolumeQuotaRuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticVolumeQuotaRules", "volumeQuotaRules", "volumeQuotaRules"), - resourceids.UserSpecifiedSegment("volumeQuotaRuleName", "volumeQuotaRuleValue"), - } -} - -// String returns a human-readable description of this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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), - fmt.Sprintf("Volume Quota Rule Name: %q", id.VolumeQuotaRuleName), - } - return fmt.Sprintf("Volume Quota Rule (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule_test.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule_test.go deleted file mode 100644 index a6f3c9d15ab..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/id_volumequotarule_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -func TestNewVolumeQuotaRuleID(t *testing.T) { - id := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.VolumeQuotaRuleName != "volumeQuotaRuleValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeQuotaRuleName'", id.VolumeQuotaRuleName, "volumeQuotaRuleValue") - } -} - -func TestFormatVolumeQuotaRuleID(t *testing.T) { - actual := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeQuotaRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestParseVolumeQuotaRuleIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - VolumeQuotaRuleName: "vOlUmEqUoTaRuLeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestSegmentsForVolumeQuotaRuleId(t *testing.T) { - segments := VolumeQuotaRuleId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeQuotaRuleId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_create.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_create.go deleted file mode 100644 index f052dfadc2f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Create ... -func (c VolumeQuotaRulesClient) Create(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) (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 VolumeQuotaRulesClient) CreateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) 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/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_delete.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_delete.go deleted file mode 100644 index 59d6fbecf0a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient) Delete(ctx context.Context, id VolumeQuotaRuleId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeQuotaRulesClient) DeleteThenPoll(ctx context.Context, id VolumeQuotaRuleId) 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/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_get.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_get.go deleted file mode 100644 index bed8822bc79..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumequotarules - -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 *VolumeQuotaRule -} - -// Get ... -func (c VolumeQuotaRulesClient) Get(ctx context.Context, id VolumeQuotaRuleId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_listbyvolume.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_listbyvolume.go deleted file mode 100644 index 1bdc8b8007c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_listbyvolume.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumequotarules - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VolumeQuotaRulesList -} - -// ListByVolume ... -func (c VolumeQuotaRulesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumeQuotaRules", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_update.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_update.go deleted file mode 100644 index 2201827bac1..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Update ... -func (c VolumeQuotaRulesClient) Update(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) (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 VolumeQuotaRulesClient) UpdateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) 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/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarule.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarule.go deleted file mode 100644 index 9436f5c0008..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarule.go +++ /dev/null @@ -1,18 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRule struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulepatch.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulepatch.go deleted file mode 100644 index fbf72546c43..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulepatch.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulePatch struct { - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotaruleslist.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotaruleslist.go deleted file mode 100644 index d9e15cf8035..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotaruleslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesList struct { - Value *[]VolumeQuotaRule `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulesproperties.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulesproperties.go deleted file mode 100644 index 5ae037e0a23..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/model_volumequotarulesproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesProperties struct { - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - QuotaSizeInKiBs *int64 `json:"quotaSizeInKiBs,omitempty"` - QuotaTarget *string `json:"quotaTarget,omitempty"` - QuotaType *Type `json:"quotaType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumequotarules/version.go b/resource-manager/netapp/2022-11-01-preview/volumequotarules/version.go deleted file mode 100644 index 8fb8d556b24..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumequotarules/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumequotarules - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumequotarules/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/README.md b/resource-manager/netapp/2022-11-01-preview/volumes/README.md deleted file mode 100644 index e0e9792332b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumes` Documentation - -The `volumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/volumes" -``` - - -### Client Initialization - -```go -client := volumes.NewVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.Volume{ - // ... -} - - -if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Delete` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Get` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesClient.List` - -```go -ctx := context.TODO() -id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `VolumesClient.Update` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.VolumePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/client.go b/resource-manager/netapp/2022-11-01-preview/volumes/client.go deleted file mode 100644 index 9f34fb4a6eb..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumes - -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 VolumesClient struct { - Client *resourcemanager.Client -} - -func NewVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) - } - - return &VolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/constants.go b/resource-manager/netapp/2022-11-01-preview/volumes/constants.go deleted file mode 100644 index 0401d41754c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/constants.go +++ /dev/null @@ -1,558 +0,0 @@ -package volumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityAcrossTTwo VolumeStorageToNetworkProximity = "AcrossT2" - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityAcrossTTwo), - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "acrosst2": VolumeStorageToNetworkProximityAcrossTTwo, - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go b/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go deleted file mode 100644 index 9ce092f4fe4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool_test.go b/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool_test.go deleted file mode 100644 index 055d673d4be..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go deleted file mode 100644 index 0b27e4a330c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/volumes/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/volumes/id_volume_test.go deleted file mode 100644 index 6c6b2858724..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/method_createorupdate.go b/resource-manager/netapp/2022-11-01-preview/volumes/method_createorupdate.go deleted file mode 100644 index 87a3cdb945a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/method_createorupdate.go +++ /dev/null @@ -1,75 +0,0 @@ -package volumes - -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 -} - -// CreateOrUpdate ... -func (c VolumesClient) CreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (result CreateOrUpdateOperationResponse, 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 -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c VolumesClient) CreateOrUpdateThenPoll(ctx context.Context, id VolumeId, input Volume) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/method_delete.go b/resource-manager/netapp/2022-11-01-preview/volumes/method_delete.go deleted file mode 100644 index 23734d43ae5..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/method_delete.go +++ /dev/null @@ -1,98 +0,0 @@ -package volumes - -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 -} - -type DeleteOperationOptions struct { - ForceDelete *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o DeleteOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - return &out -} - -func (o DeleteOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.ForceDelete != nil { - out.Append("forceDelete", fmt.Sprintf("%v", *o.ForceDelete)) - } - return &out -} - -// Delete ... -func (c VolumesClient) Delete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (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(), - OptionsObject: options, - } - - 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 VolumesClient) DeleteThenPoll(ctx context.Context, id VolumeId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/method_get.go b/resource-manager/netapp/2022-11-01-preview/volumes/method_get.go deleted file mode 100644 index f7865a3e320..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumes - -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 *Volume -} - -// Get ... -func (c VolumesClient) Get(ctx context.Context, id VolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/method_list.go b/resource-manager/netapp/2022-11-01-preview/volumes/method_list.go deleted file mode 100644 index aeea477a83f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/method_list.go +++ /dev/null @@ -1,89 +0,0 @@ -package volumes - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]Volume -} - -type ListCompleteResult struct { - Items []Volume -} - -// List ... -func (c VolumesClient) List(ctx context.Context, id CapacityPoolId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 *[]Volume `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListComplete retrieves all the results into a single object -func (c VolumesClient) ListComplete(ctx context.Context, id CapacityPoolId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, VolumeOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c VolumesClient) ListCompleteMatchingPredicate(ctx context.Context, id CapacityPoolId, predicate VolumeOperationPredicate) (result ListCompleteResult, err error) { - items := make([]Volume, 0) - - resp, err := c.List(ctx, id) - if err != nil { - 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 = ListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/method_update.go b/resource-manager/netapp/2022-11-01-preview/volumes/method_update.go deleted file mode 100644 index 57573abc0e0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumes - -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 -} - -// Update ... -func (c VolumesClient) Update(ctx context.Context, id VolumeId, input VolumePatch) (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 VolumesClient) UpdateThenPoll(ctx context.Context, id VolumeId, input VolumePatch) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_exportpolicyrule.go deleted file mode 100644 index 9b059c74757..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_mounttargetproperties.go deleted file mode 100644 index 7f5c238183c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 588e9729c1e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_replicationobject.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_replicationobject.go deleted file mode 100644 index b7d6873811e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volume.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volume.go deleted file mode 100644 index 1679818444b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package volumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumebackupproperties.go deleted file mode 100644 index 18b857b1e72..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumebackupproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - BackupVaultId *string `json:"backupVaultId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatch.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatch.go deleted file mode 100644 index b39ea01aee8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumePatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchproperties.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchproperties.go deleted file mode 100644 index a886fb5ec38..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchproperties.go +++ /dev/null @@ -1,21 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold *int64 `json:"usageThreshold,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesdataprotection.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesdataprotection.go deleted file mode 100644 index 8c9edc10ff7..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesdataprotection.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesexportpolicy.go deleted file mode 100644 index ae83a5fc1b4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepatchpropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumeproperties.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumeproperties.go deleted file mode 100644 index 2633c99c19f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumeproperties.go +++ /dev/null @@ -1,60 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - ActualThroughputMibps *float64 `json:"actualThroughputMibps,omitempty"` - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - OriginatingResourceId *string `json:"originatingResourceId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index fcf952952d2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` - VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index fda5f4739de..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumerelocationproperties.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumerelocationproperties.go deleted file mode 100644 index 23274832779..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-11-01-preview/volumes/model_volumesnapshotproperties.go deleted file mode 100644 index 48aba2acce0..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/predicates.go b/resource-manager/netapp/2022-11-01-preview/volumes/predicates.go deleted file mode 100644 index fcc54ae5e26..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -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 VolumeOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p VolumeOperationPredicate) Matches(input Volume) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumes/version.go b/resource-manager/netapp/2022-11-01-preview/volumes/version.go deleted file mode 100644 index 888b3fb9bbc..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/README.md b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/README.md deleted file mode 100644 index 8192b596797..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/README.md +++ /dev/null @@ -1,61 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumesrelocation` Documentation - -The `volumesrelocation` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/volumesrelocation" -``` - - -### Client Initialization - -```go -client := volumesrelocation.NewVolumesRelocationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRelocationClient.VolumesFinalizeRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesFinalizeRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRelocate` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrelocation.RelocateVolumeRequest{ - // ... -} - - -if err := client.VolumesRelocateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRevertRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesRevertRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/client.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/client.go deleted file mode 100644 index 9170c859f6f..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrelocation - -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 VolumesRelocationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRelocationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRelocationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrelocation", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) - } - - return &VolumesRelocationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go deleted file mode 100644 index c10d0bf30cd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrelocation - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume_test.go deleted file mode 100644 index 1956a28a604..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrelocation - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesfinalizerelocation.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesfinalizerelocation.go deleted file mode 100644 index 8bc1cc1b39a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesfinalizerelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesFinalizeRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesFinalizeRelocation ... -func (c VolumesRelocationClient) VolumesFinalizeRelocation(ctx context.Context, id VolumeId) (result VolumesFinalizeRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/finalizeRelocation", 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 -} - -// VolumesFinalizeRelocationThenPoll performs VolumesFinalizeRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesFinalizeRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesFinalizeRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesFinalizeRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesFinalizeRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrelocate.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrelocate.go deleted file mode 100644 index 1207d489ed4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrelocate.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrelocation - -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 VolumesRelocateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRelocate ... -func (c VolumesRelocationClient) VolumesRelocate(ctx context.Context, id VolumeId, input RelocateVolumeRequest) (result VolumesRelocateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/relocate", 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 -} - -// VolumesRelocateThenPoll performs VolumesRelocate then polls until it's completed -func (c VolumesRelocationClient) VolumesRelocateThenPoll(ctx context.Context, id VolumeId, input RelocateVolumeRequest) error { - result, err := c.VolumesRelocate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRelocate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRelocate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrevertrelocation.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrevertrelocation.go deleted file mode 100644 index 0091b1304fd..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/method_volumesrevertrelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesRevertRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevertRelocation ... -func (c VolumesRelocationClient) VolumesRevertRelocation(ctx context.Context, id VolumeId) (result VolumesRevertRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revertRelocation", 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 -} - -// VolumesRevertRelocationThenPoll performs VolumesRevertRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesRevertRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesRevertRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesRevertRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevertRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/model_relocatevolumerequest.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/model_relocatevolumerequest.go deleted file mode 100644 index 25cb3a56801..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/model_relocatevolumerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrelocation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RelocateVolumeRequest struct { - CreationToken *string `json:"creationToken,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/version.go b/resource-manager/netapp/2022-11-01-preview/volumesrelocation/version.go deleted file mode 100644 index c7fbd62e528..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrelocation/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrelocation - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrelocation/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/README.md b/resource-manager/netapp/2022-11-01-preview/volumesreplication/README.md deleted file mode 100644 index 3c64d638227..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/README.md +++ /dev/null @@ -1,139 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumesreplication` Documentation - -The `volumesreplication` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/volumesreplication" -``` - - -### Client Initialization - -```go -client := volumesreplication.NewVolumesReplicationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesReplicationClient.VolumesAuthorizeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.AuthorizeRequest{ - // ... -} - - -if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesBreakReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.BreakReplicationRequest{ - // ... -} - - -if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesDeleteReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesListReplications` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesListReplications(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReInitializeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReestablishReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.ReestablishReplicationRequest{ - // ... -} - - -if err := client.VolumesReestablishReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReplicationStatus` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesReplicationStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesResyncReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/client.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/client.go deleted file mode 100644 index 278506e484e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesreplication - -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 VolumesReplicationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesReplicationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesReplicationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesreplication", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) - } - - return &VolumesReplicationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/constants.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/constants.go deleted file mode 100644 index 2e5196391b7..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/constants.go +++ /dev/null @@ -1,180 +0,0 @@ -package volumesreplication - -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 EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go deleted file mode 100644 index c68d5f31c45..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesreplication - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume_test.go deleted file mode 100644 index b7b6501115b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesreplication - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesauthorizereplication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesauthorizereplication.go deleted file mode 100644 index 591d7c626ab..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesauthorizereplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesAuthorizeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesAuthorizeReplication ... -func (c VolumesReplicationClient) VolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (result VolumesAuthorizeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/authorizeReplication", 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 -} - -// VolumesAuthorizeReplicationThenPoll performs VolumesAuthorizeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesAuthorizeReplicationThenPoll(ctx context.Context, id VolumeId, input AuthorizeRequest) error { - result, err := c.VolumesAuthorizeReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesAuthorizeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesAuthorizeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesbreakreplication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesbreakreplication.go deleted file mode 100644 index 280008e8175..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesbreakreplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesBreakReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakReplication ... -func (c VolumesReplicationClient) VolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (result VolumesBreakReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakReplication", 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 -} - -// VolumesBreakReplicationThenPoll performs VolumesBreakReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesBreakReplicationThenPoll(ctx context.Context, id VolumeId, input BreakReplicationRequest) error { - result, err := c.VolumesBreakReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesdeletereplication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesdeletereplication.go deleted file mode 100644 index cda9737c512..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesdeletereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesDeleteReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesDeleteReplication ... -func (c VolumesReplicationClient) VolumesDeleteReplication(ctx context.Context, id VolumeId) (result VolumesDeleteReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/deleteReplication", 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 -} - -// VolumesDeleteReplicationThenPoll performs VolumesDeleteReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesDeleteReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesDeleteReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesDeleteReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesDeleteReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumeslistreplications.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumeslistreplications.go deleted file mode 100644 index c85aaaca41b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumeslistreplications.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesListReplicationsOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ListReplications -} - -// VolumesListReplications ... -func (c VolumesReplicationClient) VolumesListReplications(ctx context.Context, id VolumeId) (result VolumesListReplicationsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/listReplications", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreestablishreplication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreestablishreplication.go deleted file mode 100644 index 047fc04a7f9..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreestablishreplication.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumesreplication - -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 VolumesReestablishReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReestablishReplication ... -func (c VolumesReplicationClient) VolumesReestablishReplication(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) (result VolumesReestablishReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reestablishReplication", 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 -} - -// VolumesReestablishReplicationThenPoll performs VolumesReestablishReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReestablishReplicationThenPoll(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) error { - result, err := c.VolumesReestablishReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesReestablishReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReestablishReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreinitializereplication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreinitializereplication.go deleted file mode 100644 index 3f479bf637a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreinitializereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesReInitializeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReInitializeReplication ... -func (c VolumesReplicationClient) VolumesReInitializeReplication(ctx context.Context, id VolumeId) (result VolumesReInitializeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reinitializeReplication", 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 -} - -// VolumesReInitializeReplicationThenPoll performs VolumesReInitializeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReInitializeReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesReInitializeReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesReInitializeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReInitializeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreplicationstatus.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreplicationstatus.go deleted file mode 100644 index af1138c5648..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesreplicationstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesReplicationStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ReplicationStatus -} - -// VolumesReplicationStatus ... -func (c VolumesReplicationClient) VolumesReplicationStatus(ctx context.Context, id VolumeId) (result VolumesReplicationStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/replicationStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesresyncreplication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesresyncreplication.go deleted file mode 100644 index 23e1a66f518..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/method_volumesresyncreplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesResyncReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResyncReplication ... -func (c VolumesReplicationClient) VolumesResyncReplication(ctx context.Context, id VolumeId) (result VolumesResyncReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resyncReplication", 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 -} - -// VolumesResyncReplicationThenPoll performs VolumesResyncReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesResyncReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResyncReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResyncReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResyncReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_authorizerequest.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_authorizerequest.go deleted file mode 100644 index ff1cefa31ef..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_authorizerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthorizeRequest struct { - RemoteVolumeResourceId *string `json:"remoteVolumeResourceId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_breakreplicationrequest.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_breakreplicationrequest.go deleted file mode 100644 index b6a0a179a9c..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_breakreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakReplicationRequest struct { - ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_listreplications.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_listreplications.go deleted file mode 100644 index 7929ea4ace4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_listreplications.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListReplications struct { - Value *[]Replication `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_reestablishreplicationrequest.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_reestablishreplicationrequest.go deleted file mode 100644 index 193b71f1490..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_reestablishreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReestablishReplicationRequest struct { - SourceVolumeId *string `json:"sourceVolumeId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replication.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replication.go deleted file mode 100644 index 06e345fdb5e..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replication.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Replication struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replicationstatus.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replicationstatus.go deleted file mode 100644 index 2a79dddf7a4..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/model_replicationstatus.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalProgress *string `json:"totalProgress,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesreplication/version.go b/resource-manager/netapp/2022-11-01-preview/volumesreplication/version.go deleted file mode 100644 index 6ec3757e6ac..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesreplication/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesreplication/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/README.md b/resource-manager/netapp/2022-11-01-preview/volumesrevert/README.md deleted file mode 100644 index c64a92ba95a..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01-preview/volumesrevert` Documentation - -The `volumesrevert` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-01-preview`). - -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/2022-11-01-preview/volumesrevert" -``` - - -### Client Initialization - -```go -client := volumesrevert.NewVolumesRevertClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRevertClient.VolumesRevert` - -```go -ctx := context.TODO() -id := volumesrevert.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrevert.VolumeRevert{ - // ... -} - - -if err := client.VolumesRevertThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/client.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/client.go deleted file mode 100644 index fa2bad78d7b..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrevert - -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 VolumesRevertClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRevertClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRevertClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrevert", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) - } - - return &VolumesRevertClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go deleted file mode 100644 index 576a30b9904..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrevert - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume_test.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume_test.go deleted file mode 100644 index 46df3f272f2..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrevert - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/method_volumesrevert.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/method_volumesrevert.go deleted file mode 100644 index 0be129fdd47..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/method_volumesrevert.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrevert - -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 VolumesRevertOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevert ... -func (c VolumesRevertClient) VolumesRevert(ctx context.Context, id VolumeId, input VolumeRevert) (result VolumesRevertOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revert", 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 -} - -// VolumesRevertThenPoll performs VolumesRevert then polls until it's completed -func (c VolumesRevertClient) VolumesRevertThenPoll(ctx context.Context, id VolumeId, input VolumeRevert) error { - result, err := c.VolumesRevert(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRevert: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevert: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/model_volumerevert.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/model_volumerevert.go deleted file mode 100644 index c5adf461cf8..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/model_volumerevert.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrevert - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRevert struct { - SnapshotId *string `json:"snapshotId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01-preview/volumesrevert/version.go b/resource-manager/netapp/2022-11-01-preview/volumesrevert/version.go deleted file mode 100644 index 7e4192cde60..00000000000 --- a/resource-manager/netapp/2022-11-01-preview/volumesrevert/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrevert - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01-preview" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrevert/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/README.md b/resource-manager/netapp/2022-11-01/backuppolicy/README.md deleted file mode 100644 index d58ba6f319c..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/backuppolicy` Documentation - -The `backuppolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue", "backupPolicyValue") - -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", "netAppAccountValue") - -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", "netAppAccountValue", "backupPolicyValue") - -payload := backuppolicy.BackupPolicyPatch{ - // ... -} - - -if err := client.BackupPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/client.go b/resource-manager/netapp/2022-11-01/backuppolicy/client.go deleted file mode 100644 index 1db45e634e5..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backuppolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupPolicyClient: %+v", err) - } - - return &BackupPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go b/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go deleted file mode 100644 index f16f0b462b8..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticBackupPolicies", "backupPolicies", "backupPolicies"), - resourceids.UserSpecifiedSegment("backupPolicyName", "backupPolicyValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy_test.go b/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy_test.go deleted file mode 100644 index 577058e02d3..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/id_backuppolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupPolicyId{} - -func TestNewBackupPolicyID(t *testing.T) { - id := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.BackupPolicyName != "backupPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupPolicyName'", id.BackupPolicyName, "backupPolicyValue") - } -} - -func TestFormatBackupPolicyID(t *testing.T) { - actual := NewBackupPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "backupPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestParseBackupPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - BackupPolicyName: "backupPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/backupPolicies/backupPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe", - Expected: &BackupPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - BackupPolicyName: "bAcKuPpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/bAcKuPpOlIcIeS/bAcKuPpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.BackupPolicyName != v.Expected.BackupPolicyName { - t.Fatalf("Expected %q but got %q for BackupPolicyName", v.Expected.BackupPolicyName, actual.BackupPolicyName) - } - - } -} - -func TestSegmentsForBackupPolicyId(t *testing.T) { - segments := BackupPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go deleted file mode 100644 index 6b11cb40365..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backuppolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount_test.go deleted file mode 100644 index 2d0f311d8d1..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backuppolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciescreate.go b/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciescreate.go deleted file mode 100644 index f0b9cef4c28..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciescreate.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesdelete.go b/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesdelete.go deleted file mode 100644 index 482cdc1780e..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesget.go b/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesget.go deleted file mode 100644 index 95b4f6f56a8..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppolicieslist.go b/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppolicieslist.go deleted file mode 100644 index 2730e8afc34..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesupdate.go b/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesupdate.go deleted file mode 100644 index 8e5456d63ac..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/method_backuppoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicieslist.go b/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicieslist.go deleted file mode 100644 index 3db3d131a60..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicy.go b/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicy.go deleted file mode 100644 index 747ab65be24..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -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/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicypatch.go b/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicypatch.go deleted file mode 100644 index bf7eecb1358..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -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/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicyproperties.go b/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicyproperties.go deleted file mode 100644 index d5694f4797d..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/model_backuppolicyproperties.go +++ /dev/null @@ -1,15 +0,0 @@ -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/resource-manager/netapp/2022-11-01/backuppolicy/model_volumebackups.go b/resource-manager/netapp/2022-11-01/backuppolicy/model_volumebackups.go deleted file mode 100644 index c01a5c25fd5..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/model_volumebackups.go +++ /dev/null @@ -1,10 +0,0 @@ -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"` -} diff --git a/resource-manager/netapp/2022-11-01/backuppolicy/version.go b/resource-manager/netapp/2022-11-01/backuppolicy/version.go deleted file mode 100644 index 43347feaadc..00000000000 --- a/resource-manager/netapp/2022-11-01/backuppolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backuppolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backuppolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/backups/README.md b/resource-manager/netapp/2022-11-01/backups/README.md deleted file mode 100644 index 28cbb71d2d5..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/README.md +++ /dev/null @@ -1,175 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/backups` Documentation - -The `backups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/backups" -``` - - -### Client Initialization - -```go -client := backups.NewBackupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `BackupsClient.AccountBackupsDelete` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -if err := client.AccountBackupsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsGet` - -```go -ctx := context.TODO() -id := backups.NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - -read, err := client.AccountBackupsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.AccountBackupsList` - -```go -ctx := context.TODO() -id := backups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountBackupsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.Create` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -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.GetStatus` - -```go -ctx := context.TODO() -id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.GetStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.List` - -```go -ctx := context.TODO() -id := backups.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `BackupsClient.RestoreFiles` - -```go -ctx := context.TODO() -id := backups.NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -payload := backups.BackupRestoreFiles{ - // ... -} - - -if err := client.RestoreFilesThenPoll(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", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - -payload := backups.BackupPatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/backups/client.go b/resource-manager/netapp/2022-11-01/backups/client.go deleted file mode 100644 index a0f81d2a6ab..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -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.NewResourceManagerClient(sdkApi, "backups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating BackupsClient: %+v", err) - } - - return &BackupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/backups/constants.go b/resource-manager/netapp/2022-11-01/backups/constants.go deleted file mode 100644 index e2ac45e345b..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/constants.go +++ /dev/null @@ -1,136 +0,0 @@ -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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go b/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go deleted file mode 100644 index b4091d27265..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_accountbackup.go +++ /dev/null @@ -1,134 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -// AccountBackupId is a struct representing the Resource ID for a Account Backup -type AccountBackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - AccountBackupName string -} - -// NewAccountBackupID returns a new AccountBackupId struct -func NewAccountBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, accountBackupName string) AccountBackupId { - return AccountBackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - AccountBackupName: accountBackupName, - } -} - -// ParseAccountBackupID parses 'input' into a AccountBackupId -func ParseAccountBackupID(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseAccountBackupIDInsensitively parses 'input' case-insensitively into a AccountBackupId -// note: this method should only be used for API response data and not user input -func ParseAccountBackupIDInsensitively(input string) (*AccountBackupId, error) { - parser := resourceids.NewParserFromResourceIdType(AccountBackupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := AccountBackupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *AccountBackupId) 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.AccountBackupName, ok = input.Parsed["accountBackupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "accountBackupName", input) - } - - return nil -} - -// ValidateAccountBackupID checks that 'input' can be parsed as a Account Backup ID -func ValidateAccountBackupID(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 := ParseAccountBackupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Account Backup ID -func (id AccountBackupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/accountBackups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.AccountBackupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Account Backup ID -func (id AccountBackupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticAccountBackups", "accountBackups", "accountBackups"), - resourceids.UserSpecifiedSegment("accountBackupName", "accountBackupValue"), - } -} - -// String returns a human-readable description of this Account Backup ID -func (id AccountBackupId) 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("Account Backup Name: %q", id.AccountBackupName), - } - return fmt.Sprintf("Account Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/backups/id_accountbackup_test.go b/resource-manager/netapp/2022-11-01/backups/id_accountbackup_test.go deleted file mode 100644 index 5371bde3e0a..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_accountbackup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = AccountBackupId{} - -func TestNewAccountBackupID(t *testing.T) { - id := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.AccountBackupName != "accountBackupValue" { - t.Fatalf("Expected %q but got %q for Segment 'AccountBackupName'", id.AccountBackupName, "accountBackupValue") - } -} - -func TestFormatAccountBackupID(t *testing.T) { - actual := NewAccountBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "accountBackupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseAccountBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestParseAccountBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *AccountBackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - AccountBackupName: "accountBackupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/accountBackups/accountBackupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE", - Expected: &AccountBackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - AccountBackupName: "aCcOuNtBaCkUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/aCcOuNtBaCkUpS/aCcOuNtBaCkUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseAccountBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.AccountBackupName != v.Expected.AccountBackupName { - t.Fatalf("Expected %q but got %q for AccountBackupName", v.Expected.AccountBackupName, actual.AccountBackupName) - } - - } -} - -func TestSegmentsForAccountBackupId(t *testing.T) { - segments := AccountBackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("AccountBackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/backups/id_backup.go b/resource-manager/netapp/2022-11-01/backups/id_backup.go deleted file mode 100644 index 9c95bd9350f..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_backup.go +++ /dev/null @@ -1,152 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -// BackupId is a struct representing the Resource ID for a Backup -type BackupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - BackupName string -} - -// NewBackupID returns a new BackupId struct -func NewBackupID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, backupName string) BackupId { - return BackupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - 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.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) - } - - 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/capacityPools/%s/volumes/%s/backups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticBackups", "backups", "backups"), - resourceids.UserSpecifiedSegment("backupName", "backupValue"), - } -} - -// 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("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Backup Name: %q", id.BackupName), - } - return fmt.Sprintf("Backup (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/backups/id_backup_test.go b/resource-manager/netapp/2022-11-01/backups/id_backup_test.go deleted file mode 100644 index e6ca856e47e..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_backup_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = BackupId{} - -func TestNewBackupID(t *testing.T) { - id := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.BackupName != "backupValue" { - t.Fatalf("Expected %q but got %q for Segment 'BackupName'", id.BackupName, "backupValue") - } -} - -func TestFormatBackupID(t *testing.T) { - actual := NewBackupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "backupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseBackupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestParseBackupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *BackupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - BackupName: "backupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/backups/backupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs/bAcKuPvAlUe", - Expected: &BackupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - BackupName: "bAcKuPvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/bAcKuPs/bAcKuPvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseBackupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.BackupName != v.Expected.BackupName { - t.Fatalf("Expected %q but got %q for BackupName", v.Expected.BackupName, actual.BackupName) - } - - } -} - -func TestSegmentsForBackupId(t *testing.T) { - segments := BackupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("BackupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go b/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go deleted file mode 100644 index ced6c2088e0..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/backups/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01/backups/id_netappaccount_test.go deleted file mode 100644 index bc4a37eeffd..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/backups/id_volume.go b/resource-manager/netapp/2022-11-01/backups/id_volume.go deleted file mode 100644 index 247b20b073e..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package backups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/backups/id_volume_test.go b/resource-manager/netapp/2022-11-01/backups/id_volume_test.go deleted file mode 100644 index d8f88fb84a4..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package backups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_accountbackupsdelete.go b/resource-manager/netapp/2022-11-01/backups/method_accountbackupsdelete.go deleted file mode 100644 index a55df55cf2e..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_accountbackupsdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -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 AccountBackupsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountBackupsDelete ... -func (c BackupsClient) AccountBackupsDelete(ctx context.Context, id AccountBackupId) (result AccountBackupsDeleteOperationResponse, 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 -} - -// AccountBackupsDeleteThenPoll performs AccountBackupsDelete then polls until it's completed -func (c BackupsClient) AccountBackupsDeleteThenPoll(ctx context.Context, id AccountBackupId) error { - result, err := c.AccountBackupsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountBackupsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountBackupsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_accountbackupsget.go b/resource-manager/netapp/2022-11-01/backups/method_accountbackupsget.go deleted file mode 100644 index 1f242db5125..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_accountbackupsget.go +++ /dev/null @@ -1,51 +0,0 @@ -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 AccountBackupsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *Backup -} - -// AccountBackupsGet ... -func (c BackupsClient) AccountBackupsGet(ctx context.Context, id AccountBackupId) (result AccountBackupsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_accountbackupslist.go b/resource-manager/netapp/2022-11-01/backups/method_accountbackupslist.go deleted file mode 100644 index 702e9d3951d..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_accountbackupslist.go +++ /dev/null @@ -1,52 +0,0 @@ -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 AccountBackupsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -// AccountBackupsList ... -func (c BackupsClient) AccountBackupsList(ctx context.Context, id NetAppAccountId) (result AccountBackupsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/accountBackups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_create.go b/resource-manager/netapp/2022-11-01/backups/method_create.go deleted file mode 100644 index 0e97dd6521a..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -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 -} - -// 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.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 -} - -// 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/resource-manager/netapp/2022-11-01/backups/method_delete.go b/resource-manager/netapp/2022-11-01/backups/method_delete.go deleted file mode 100644 index 3472a05fa69..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -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, - 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 -} - -// 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/resource-manager/netapp/2022-11-01/backups/method_get.go b/resource-manager/netapp/2022-11-01/backups/method_get.go deleted file mode 100644 index 4ea8ec97737..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_getstatus.go b/resource-manager/netapp/2022-11-01/backups/method_getstatus.go deleted file mode 100644 index 0fed6c10cee..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_getstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -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 GetStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupStatus -} - -// GetStatus ... -func (c BackupsClient) GetStatus(ctx context.Context, id VolumeId) (result GetStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/backupStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_list.go b/resource-manager/netapp/2022-11-01/backups/method_list.go deleted file mode 100644 index f88403c6c9f..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *BackupsList -} - -// List ... -func (c BackupsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - 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.Execute(ctx) - if resp != nil { - result.OData = resp.OData - result.HttpResponse = resp.Response - } - if err != nil { - return - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_restorefiles.go b/resource-manager/netapp/2022-11-01/backups/method_restorefiles.go deleted file mode 100644 index 1926e145afb..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_restorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -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 RestoreFilesOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// RestoreFiles ... -func (c BackupsClient) RestoreFiles(ctx context.Context, id BackupId, input BackupRestoreFiles) (result RestoreFilesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - 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 -} - -// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed -func (c BackupsClient) RestoreFilesThenPoll(ctx context.Context, id BackupId, input BackupRestoreFiles) error { - result, err := c.RestoreFiles(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RestoreFiles: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after RestoreFiles: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/backups/method_update.go b/resource-manager/netapp/2022-11-01/backups/method_update.go deleted file mode 100644 index 38c6398f381..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -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 -} - -// 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/resource-manager/netapp/2022-11-01/backups/model_backup.go b/resource-manager/netapp/2022-11-01/backups/model_backup.go deleted file mode 100644 index d3f65f0a7d1..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/model_backup.go +++ /dev/null @@ -1,17 +0,0 @@ -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"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties BackupProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/backups/model_backuppatch.go b/resource-manager/netapp/2022-11-01/backups/model_backuppatch.go deleted file mode 100644 index 5354276c3d2..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/model_backuppatch.go +++ /dev/null @@ -1,9 +0,0 @@ -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 *BackupProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/backups/model_backupproperties.go b/resource-manager/netapp/2022-11-01/backups/model_backupproperties.go deleted file mode 100644 index 800c6da1e29..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/model_backupproperties.go +++ /dev/null @@ -1,34 +0,0 @@ -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"` - 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"` - UseExistingSnapshot *bool `json:"useExistingSnapshot,omitempty"` - VolumeName *string `json:"volumeName,omitempty"` -} - -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/resource-manager/netapp/2022-11-01/backups/model_backuprestorefiles.go b/resource-manager/netapp/2022-11-01/backups/model_backuprestorefiles.go deleted file mode 100644 index e26ce886407..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/model_backuprestorefiles.go +++ /dev/null @@ -1,10 +0,0 @@ -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/resource-manager/netapp/2022-11-01/backups/model_backupslist.go b/resource-manager/netapp/2022-11-01/backups/model_backupslist.go deleted file mode 100644 index d2e3929dbc7..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/model_backupslist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 BackupsList struct { - Value *[]Backup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/backups/model_backupstatus.go b/resource-manager/netapp/2022-11-01/backups/model_backupstatus.go deleted file mode 100644 index 28d092897d7..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/model_backupstatus.go +++ /dev/null @@ -1,15 +0,0 @@ -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"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/backups/version.go b/resource-manager/netapp/2022-11-01/backups/version.go deleted file mode 100644 index 557176f2399..00000000000 --- a/resource-manager/netapp/2022-11-01/backups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package backups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/backups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/README.md b/resource-manager/netapp/2022-11-01/capacitypools/README.md deleted file mode 100644 index da510b15968..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/capacitypools` Documentation - -The `capacitypools` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/capacitypools" -``` - - -### Client Initialization - -```go -client := capacitypools.NewCapacityPoolsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `CapacityPoolsClient.PoolsCreateOrUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPool{ - // ... -} - - -if err := client.PoolsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsDelete` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -if err := client.PoolsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsGet` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -read, err := client.PoolsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsList` - -```go -ctx := context.TODO() -id := capacitypools.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -// alternatively `client.PoolsList(ctx, id)` can be used to do batched pagination -items, err := client.PoolsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `CapacityPoolsClient.PoolsUpdate` - -```go -ctx := context.TODO() -id := capacitypools.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -payload := capacitypools.CapacityPoolPatch{ - // ... -} - - -if err := client.PoolsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/capacitypools/client.go b/resource-manager/netapp/2022-11-01/capacitypools/client.go deleted file mode 100644 index 3de33a3dc5b..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package capacitypools - -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 CapacityPoolsClient struct { - Client *resourcemanager.Client -} - -func NewCapacityPoolsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityPoolsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "capacitypools", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating CapacityPoolsClient: %+v", err) - } - - return &CapacityPoolsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/constants.go b/resource-manager/netapp/2022-11-01/capacitypools/constants.go deleted file mode 100644 index 802074e5dc1..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/constants.go +++ /dev/null @@ -1,139 +0,0 @@ -package capacitypools - -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 EncryptionType string - -const ( - EncryptionTypeDouble EncryptionType = "Double" - EncryptionTypeSingle EncryptionType = "Single" -) - -func PossibleValuesForEncryptionType() []string { - return []string{ - string(EncryptionTypeDouble), - string(EncryptionTypeSingle), - } -} - -func (s *EncryptionType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionType(input string) (*EncryptionType, error) { - vals := map[string]EncryptionType{ - "double": EncryptionTypeDouble, - "single": EncryptionTypeSingle, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionType(input) - return &out, nil -} - -type QosType string - -const ( - QosTypeAuto QosType = "Auto" - QosTypeManual QosType = "Manual" -) - -func PossibleValuesForQosType() []string { - return []string{ - string(QosTypeAuto), - string(QosTypeManual), - } -} - -func (s *QosType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseQosType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseQosType(input string) (*QosType, error) { - vals := map[string]QosType{ - "auto": QosTypeAuto, - "manual": QosTypeManual, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := QosType(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go b/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go deleted file mode 100644 index 69954702fd9..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool_test.go b/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool_test.go deleted file mode 100644 index a7eaff1ee66..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go b/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go deleted file mode 100644 index f424e58a9e8..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package capacitypools - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount_test.go deleted file mode 100644 index 13bb52f3713..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package capacitypools - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/method_poolscreateorupdate.go b/resource-manager/netapp/2022-11-01/capacitypools/method_poolscreateorupdate.go deleted file mode 100644 index d25b060fccf..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/method_poolscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsCreateOrUpdate ... -func (c CapacityPoolsClient) PoolsCreateOrUpdate(ctx context.Context, id CapacityPoolId, input CapacityPool) (result PoolsCreateOrUpdateOperationResponse, 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 -} - -// PoolsCreateOrUpdateThenPoll performs PoolsCreateOrUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsCreateOrUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPool) error { - result, err := c.PoolsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/method_poolsdelete.go b/resource-manager/netapp/2022-11-01/capacitypools/method_poolsdelete.go deleted file mode 100644 index 36c9e0e6bcf..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/method_poolsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package capacitypools - -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 PoolsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsDelete ... -func (c CapacityPoolsClient) PoolsDelete(ctx context.Context, id CapacityPoolId) (result PoolsDeleteOperationResponse, 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 -} - -// PoolsDeleteThenPoll performs PoolsDelete then polls until it's completed -func (c CapacityPoolsClient) PoolsDeleteThenPoll(ctx context.Context, id CapacityPoolId) error { - result, err := c.PoolsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing PoolsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/method_poolsget.go b/resource-manager/netapp/2022-11-01/capacitypools/method_poolsget.go deleted file mode 100644 index 26acc6641bb..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/method_poolsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package capacitypools - -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 PoolsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CapacityPool -} - -// PoolsGet ... -func (c CapacityPoolsClient) PoolsGet(ctx context.Context, id CapacityPoolId) (result PoolsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/method_poolslist.go b/resource-manager/netapp/2022-11-01/capacitypools/method_poolslist.go deleted file mode 100644 index 9b29e63dbdb..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/method_poolslist.go +++ /dev/null @@ -1,89 +0,0 @@ -package capacitypools - -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 PoolsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]CapacityPool -} - -type PoolsListCompleteResult struct { - Items []CapacityPool -} - -// PoolsList ... -func (c CapacityPoolsClient) PoolsList(ctx context.Context, id NetAppAccountId) (result PoolsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/capacityPools", 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 *[]CapacityPool `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// PoolsListComplete retrieves all the results into a single object -func (c CapacityPoolsClient) PoolsListComplete(ctx context.Context, id NetAppAccountId) (PoolsListCompleteResult, error) { - return c.PoolsListCompleteMatchingPredicate(ctx, id, CapacityPoolOperationPredicate{}) -} - -// PoolsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c CapacityPoolsClient) PoolsListCompleteMatchingPredicate(ctx context.Context, id NetAppAccountId, predicate CapacityPoolOperationPredicate) (result PoolsListCompleteResult, err error) { - items := make([]CapacityPool, 0) - - resp, err := c.PoolsList(ctx, id) - if err != nil { - 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 = PoolsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/method_poolsupdate.go b/resource-manager/netapp/2022-11-01/capacitypools/method_poolsupdate.go deleted file mode 100644 index 7396db6d249..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/method_poolsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package capacitypools - -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 PoolsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// PoolsUpdate ... -func (c CapacityPoolsClient) PoolsUpdate(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) (result PoolsUpdateOperationResponse, 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 -} - -// PoolsUpdateThenPoll performs PoolsUpdate then polls until it's completed -func (c CapacityPoolsClient) PoolsUpdateThenPoll(ctx context.Context, id CapacityPoolId, input CapacityPoolPatch) error { - result, err := c.PoolsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing PoolsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after PoolsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/model_capacitypool.go b/resource-manager/netapp/2022-11-01/capacitypools/model_capacitypool.go deleted file mode 100644 index f5d6f1ea86d..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/model_capacitypool.go +++ /dev/null @@ -1,19 +0,0 @@ -package capacitypools - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPool struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties PoolProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/model_capacitypoolpatch.go b/resource-manager/netapp/2022-11-01/capacitypools/model_capacitypoolpatch.go deleted file mode 100644 index 46abcde6b33..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/model_capacitypoolpatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *PoolPatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/model_poolpatchproperties.go b/resource-manager/netapp/2022-11-01/capacitypools/model_poolpatchproperties.go deleted file mode 100644 index c971dd8637c..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/model_poolpatchproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolPatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/model_poolproperties.go b/resource-manager/netapp/2022-11-01/capacitypools/model_poolproperties.go deleted file mode 100644 index a1fee733fb4..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/model_poolproperties.go +++ /dev/null @@ -1,16 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - EncryptionType *EncryptionType `json:"encryptionType,omitempty"` - PoolId *string `json:"poolId,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - QosType *QosType `json:"qosType,omitempty"` - ServiceLevel ServiceLevel `json:"serviceLevel"` - Size int64 `json:"size"` - TotalThroughputMibps *float64 `json:"totalThroughputMibps,omitempty"` - UtilizedThroughputMibps *float64 `json:"utilizedThroughputMibps,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/predicates.go b/resource-manager/netapp/2022-11-01/capacitypools/predicates.go deleted file mode 100644 index 386a7986d42..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package capacitypools - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CapacityPoolOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p CapacityPoolOperationPredicate) Matches(input CapacityPool) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-11-01/capacitypools/version.go b/resource-manager/netapp/2022-11-01/capacitypools/version.go deleted file mode 100644 index d1633f31d00..00000000000 --- a/resource-manager/netapp/2022-11-01/capacitypools/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package capacitypools - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/capacitypools/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/client.go b/resource-manager/netapp/2022-11-01/client.go deleted file mode 100644 index bf642d17c1c..00000000000 --- a/resource-manager/netapp/2022-11-01/client.go +++ /dev/null @@ -1,199 +0,0 @@ -package v2022_11_01 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -import ( - "fmt" - - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/backuppolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/backups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/capacitypools" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/filelocks" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/groupidlistforldapuser" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/netappaccounts" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/netappresource" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/poolchange" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/resetcifspassword" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/restore" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/snapshotpolicy" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/snapshots" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/subvolumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumegroups" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumequotarules" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumes" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesrelocation" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesreplication" - "github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesrevert" - "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" - sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" -) - -type Client struct { - BackupPolicy *backuppolicy.BackupPolicyClient - Backups *backups.BackupsClient - CapacityPools *capacitypools.CapacityPoolsClient - FileLocks *filelocks.FileLocksClient - GroupIdListForLDAPUser *groupidlistforldapuser.GroupIdListForLDAPUserClient - NetAppAccounts *netappaccounts.NetAppAccountsClient - NetAppResource *netappresource.NetAppResourceClient - PoolChange *poolchange.PoolChangeClient - ResetCifsPassword *resetcifspassword.ResetCifsPasswordClient - Restore *restore.RestoreClient - SnapshotPolicy *snapshotpolicy.SnapshotPolicyClient - SnapshotPolicyListVolumes *snapshotpolicylistvolumes.SnapshotPolicyListVolumesClient - Snapshots *snapshots.SnapshotsClient - SubVolumes *subvolumes.SubVolumesClient - VolumeGroups *volumegroups.VolumeGroupsClient - VolumeQuotaRules *volumequotarules.VolumeQuotaRulesClient - Volumes *volumes.VolumesClient - VolumesRelocation *volumesrelocation.VolumesRelocationClient - VolumesReplication *volumesreplication.VolumesReplicationClient - VolumesRevert *volumesrevert.VolumesRevertClient -} - -func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { - backupPolicyClient, err := backuppolicy.NewBackupPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building BackupPolicy client: %+v", err) - } - configureFunc(backupPolicyClient.Client) - - backupsClient, err := backups.NewBackupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Backups client: %+v", err) - } - configureFunc(backupsClient.Client) - - capacityPoolsClient, err := capacitypools.NewCapacityPoolsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building CapacityPools client: %+v", err) - } - configureFunc(capacityPoolsClient.Client) - - fileLocksClient, err := filelocks.NewFileLocksClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building FileLocks client: %+v", err) - } - configureFunc(fileLocksClient.Client) - - groupIdListForLDAPUserClient, err := groupidlistforldapuser.NewGroupIdListForLDAPUserClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building GroupIdListForLDAPUser client: %+v", err) - } - configureFunc(groupIdListForLDAPUserClient.Client) - - netAppAccountsClient, err := netappaccounts.NewNetAppAccountsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppAccounts client: %+v", err) - } - configureFunc(netAppAccountsClient.Client) - - netAppResourceClient, err := netappresource.NewNetAppResourceClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building NetAppResource client: %+v", err) - } - configureFunc(netAppResourceClient.Client) - - poolChangeClient, err := poolchange.NewPoolChangeClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building PoolChange client: %+v", err) - } - configureFunc(poolChangeClient.Client) - - resetCifsPasswordClient, err := resetcifspassword.NewResetCifsPasswordClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building ResetCifsPassword client: %+v", err) - } - configureFunc(resetCifsPasswordClient.Client) - - restoreClient, err := restore.NewRestoreClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Restore client: %+v", err) - } - configureFunc(restoreClient.Client) - - snapshotPolicyClient, err := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicy client: %+v", err) - } - configureFunc(snapshotPolicyClient.Client) - - snapshotPolicyListVolumesClient, err := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SnapshotPolicyListVolumes client: %+v", err) - } - configureFunc(snapshotPolicyListVolumesClient.Client) - - snapshotsClient, err := snapshots.NewSnapshotsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Snapshots client: %+v", err) - } - configureFunc(snapshotsClient.Client) - - subVolumesClient, err := subvolumes.NewSubVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building SubVolumes client: %+v", err) - } - configureFunc(subVolumesClient.Client) - - volumeGroupsClient, err := volumegroups.NewVolumeGroupsClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeGroups client: %+v", err) - } - configureFunc(volumeGroupsClient.Client) - - volumeQuotaRulesClient, err := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumeQuotaRules client: %+v", err) - } - configureFunc(volumeQuotaRulesClient.Client) - - volumesClient, err := volumes.NewVolumesClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building Volumes client: %+v", err) - } - configureFunc(volumesClient.Client) - - volumesRelocationClient, err := volumesrelocation.NewVolumesRelocationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRelocation client: %+v", err) - } - configureFunc(volumesRelocationClient.Client) - - volumesReplicationClient, err := volumesreplication.NewVolumesReplicationClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesReplication client: %+v", err) - } - configureFunc(volumesReplicationClient.Client) - - volumesRevertClient, err := volumesrevert.NewVolumesRevertClientWithBaseURI(sdkApi) - if err != nil { - return nil, fmt.Errorf("building VolumesRevert client: %+v", err) - } - configureFunc(volumesRevertClient.Client) - - return &Client{ - BackupPolicy: backupPolicyClient, - Backups: backupsClient, - CapacityPools: capacityPoolsClient, - FileLocks: fileLocksClient, - GroupIdListForLDAPUser: groupIdListForLDAPUserClient, - NetAppAccounts: netAppAccountsClient, - NetAppResource: netAppResourceClient, - PoolChange: poolChangeClient, - ResetCifsPassword: resetCifsPasswordClient, - Restore: restoreClient, - SnapshotPolicy: snapshotPolicyClient, - SnapshotPolicyListVolumes: snapshotPolicyListVolumesClient, - Snapshots: snapshotsClient, - SubVolumes: subVolumesClient, - VolumeGroups: volumeGroupsClient, - VolumeQuotaRules: volumeQuotaRulesClient, - Volumes: volumesClient, - VolumesRelocation: volumesRelocationClient, - VolumesReplication: volumesReplicationClient, - VolumesRevert: volumesRevertClient, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/filelocks/README.md b/resource-manager/netapp/2022-11-01/filelocks/README.md deleted file mode 100644 index 589169d792b..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/filelocks` Documentation - -The `filelocks` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/filelocks" -``` - - -### Client Initialization - -```go -client := filelocks.NewFileLocksClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `FileLocksClient.VolumesBreakFileLocks` - -```go -ctx := context.TODO() -id := filelocks.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := filelocks.BreakFileLocksRequest{ - // ... -} - - -if err := client.VolumesBreakFileLocksThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/filelocks/client.go b/resource-manager/netapp/2022-11-01/filelocks/client.go deleted file mode 100644 index 7f39f5ef46b..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package filelocks - -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 FileLocksClient struct { - Client *resourcemanager.Client -} - -func NewFileLocksClientWithBaseURI(sdkApi sdkEnv.Api) (*FileLocksClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "filelocks", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating FileLocksClient: %+v", err) - } - - return &FileLocksClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/filelocks/id_volume.go b/resource-manager/netapp/2022-11-01/filelocks/id_volume.go deleted file mode 100644 index 446434f9140..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package filelocks - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/filelocks/id_volume_test.go b/resource-manager/netapp/2022-11-01/filelocks/id_volume_test.go deleted file mode 100644 index ba5d9fabf43..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package filelocks - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/filelocks/method_volumesbreakfilelocks.go b/resource-manager/netapp/2022-11-01/filelocks/method_volumesbreakfilelocks.go deleted file mode 100644 index c1ff2b4b86f..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/method_volumesbreakfilelocks.go +++ /dev/null @@ -1,74 +0,0 @@ -package filelocks - -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 VolumesBreakFileLocksOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakFileLocks ... -func (c FileLocksClient) VolumesBreakFileLocks(ctx context.Context, id VolumeId, input BreakFileLocksRequest) (result VolumesBreakFileLocksOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakFileLocks", 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 -} - -// VolumesBreakFileLocksThenPoll performs VolumesBreakFileLocks then polls until it's completed -func (c FileLocksClient) VolumesBreakFileLocksThenPoll(ctx context.Context, id VolumeId, input BreakFileLocksRequest) error { - result, err := c.VolumesBreakFileLocks(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakFileLocks: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakFileLocks: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/filelocks/model_breakfilelocksrequest.go b/resource-manager/netapp/2022-11-01/filelocks/model_breakfilelocksrequest.go deleted file mode 100644 index 62fa9fc9808..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/model_breakfilelocksrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package filelocks - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakFileLocksRequest struct { - ClientIP *string `json:"clientIp,omitempty"` - ConfirmRunningDisruptiveOperation *bool `json:"confirmRunningDisruptiveOperation,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/filelocks/version.go b/resource-manager/netapp/2022-11-01/filelocks/version.go deleted file mode 100644 index e9c223ea9dc..00000000000 --- a/resource-manager/netapp/2022-11-01/filelocks/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package filelocks - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/filelocks/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/README.md b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/README.md deleted file mode 100644 index 87f68c9f247..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/groupidlistforldapuser` Documentation - -The `groupidlistforldapuser` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/groupidlistforldapuser" -``` - - -### Client Initialization - -```go -client := groupidlistforldapuser.NewGroupIdListForLDAPUserClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `GroupIdListForLDAPUserClient.VolumesListGetGroupIdListForLdapUser` - -```go -ctx := context.TODO() -id := groupidlistforldapuser.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := groupidlistforldapuser.GetGroupIdListForLDAPUserRequest{ - // ... -} - - -if err := client.VolumesListGetGroupIdListForLdapUserThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go deleted file mode 100644 index b954d6fe7dc..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package groupidlistforldapuser - -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 GroupIdListForLDAPUserClient struct { - Client *resourcemanager.Client -} - -func NewGroupIdListForLDAPUserClientWithBaseURI(sdkApi sdkEnv.Api) (*GroupIdListForLDAPUserClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "groupidlistforldapuser", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating GroupIdListForLDAPUserClient: %+v", err) - } - - return &GroupIdListForLDAPUserClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go deleted file mode 100644 index af00678327a..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package groupidlistforldapuser - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume_test.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume_test.go deleted file mode 100644 index f43d498174d..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package groupidlistforldapuser - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go deleted file mode 100644 index e062e65052e..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/method_volumeslistgetgroupidlistforldapuser.go +++ /dev/null @@ -1,74 +0,0 @@ -package groupidlistforldapuser - -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 VolumesListGetGroupIdListForLdapUserOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesListGetGroupIdListForLdapUser ... -func (c GroupIdListForLDAPUserClient) VolumesListGetGroupIdListForLdapUser(ctx context.Context, id VolumeId, input GetGroupIdListForLDAPUserRequest) (result VolumesListGetGroupIdListForLdapUserOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/getGroupIdListForLdapUser", 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 -} - -// VolumesListGetGroupIdListForLdapUserThenPoll performs VolumesListGetGroupIdListForLdapUser then polls until it's completed -func (c GroupIdListForLDAPUserClient) VolumesListGetGroupIdListForLdapUserThenPoll(ctx context.Context, id VolumeId, input GetGroupIdListForLDAPUserRequest) error { - result, err := c.VolumesListGetGroupIdListForLdapUser(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesListGetGroupIdListForLdapUser: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesListGetGroupIdListForLdapUser: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go deleted file mode 100644 index 797ecd9aa2a..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package groupidlistforldapuser - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetGroupIdListForLDAPUserRequest struct { - Username string `json:"username"` -} diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go deleted file mode 100644 index 42c528df2f2..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/model_getgroupidlistforldapuserresponse.go +++ /dev/null @@ -1,8 +0,0 @@ -package groupidlistforldapuser - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type GetGroupIdListForLDAPUserResponse struct { - GroupIdsForLdapUser *[]string `json:"groupIdsForLdapUser,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/version.go b/resource-manager/netapp/2022-11-01/groupidlistforldapuser/version.go deleted file mode 100644 index a50a68475a0..00000000000 --- a/resource-manager/netapp/2022-11-01/groupidlistforldapuser/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package groupidlistforldapuser - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/groupidlistforldapuser/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/README.md b/resource-manager/netapp/2022-11-01/netappaccounts/README.md deleted file mode 100644 index 910da5cc929..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/README.md +++ /dev/null @@ -1,128 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/netappaccounts` Documentation - -The `netappaccounts` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/netappaccounts" -``` - - -### Client Initialization - -```go -client := netappaccounts.NewNetAppAccountsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppAccountsClient.AccountsCreateOrUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccount{ - // ... -} - - -if err := client.AccountsCreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsDelete` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsGet` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.AccountsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsList` - -```go -ctx := context.TODO() -id := netappaccounts.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") - -// alternatively `client.AccountsList(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsListBySubscription` - -```go -ctx := context.TODO() -id := netappaccounts.NewSubscriptionID("12345678-1234-9876-4563-123456789012") - -// alternatively `client.AccountsListBySubscription(ctx, id)` can be used to do batched pagination -items, err := client.AccountsListBySubscriptionComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsRenewCredentials` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -if err := client.AccountsRenewCredentialsThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `NetAppAccountsClient.AccountsUpdate` - -```go -ctx := context.TODO() -id := netappaccounts.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -payload := netappaccounts.NetAppAccountPatch{ - // ... -} - - -if err := client.AccountsUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/client.go b/resource-manager/netapp/2022-11-01/netappaccounts/client.go deleted file mode 100644 index 172f1218e2c..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappaccounts - -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 NetAppAccountsClient struct { - Client *resourcemanager.Client -} - -func NewNetAppAccountsClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppAccountsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappaccounts", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppAccountsClient: %+v", err) - } - - return &NetAppAccountsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/constants.go b/resource-manager/netapp/2022-11-01/netappaccounts/constants.go deleted file mode 100644 index f8d0489c2a0..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/constants.go +++ /dev/null @@ -1,151 +0,0 @@ -package netappaccounts - -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 ActiveDirectoryStatus string - -const ( - ActiveDirectoryStatusCreated ActiveDirectoryStatus = "Created" - ActiveDirectoryStatusDeleted ActiveDirectoryStatus = "Deleted" - ActiveDirectoryStatusError ActiveDirectoryStatus = "Error" - ActiveDirectoryStatusInUse ActiveDirectoryStatus = "InUse" - ActiveDirectoryStatusUpdating ActiveDirectoryStatus = "Updating" -) - -func PossibleValuesForActiveDirectoryStatus() []string { - return []string{ - string(ActiveDirectoryStatusCreated), - string(ActiveDirectoryStatusDeleted), - string(ActiveDirectoryStatusError), - string(ActiveDirectoryStatusInUse), - string(ActiveDirectoryStatusUpdating), - } -} - -func (s *ActiveDirectoryStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseActiveDirectoryStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseActiveDirectoryStatus(input string) (*ActiveDirectoryStatus, error) { - vals := map[string]ActiveDirectoryStatus{ - "created": ActiveDirectoryStatusCreated, - "deleted": ActiveDirectoryStatusDeleted, - "error": ActiveDirectoryStatusError, - "inuse": ActiveDirectoryStatusInUse, - "updating": ActiveDirectoryStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ActiveDirectoryStatus(input) - return &out, nil -} - -type KeySource string - -const ( - KeySourceMicrosoftPointKeyVault KeySource = "Microsoft.KeyVault" - KeySourceMicrosoftPointNetApp KeySource = "Microsoft.NetApp" -) - -func PossibleValuesForKeySource() []string { - return []string{ - string(KeySourceMicrosoftPointKeyVault), - string(KeySourceMicrosoftPointNetApp), - } -} - -func (s *KeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeySource(input string) (*KeySource, error) { - vals := map[string]KeySource{ - "microsoft.keyvault": KeySourceMicrosoftPointKeyVault, - "microsoft.netapp": KeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeySource(input) - return &out, nil -} - -type KeyVaultStatus string - -const ( - KeyVaultStatusCreated KeyVaultStatus = "Created" - KeyVaultStatusDeleted KeyVaultStatus = "Deleted" - KeyVaultStatusError KeyVaultStatus = "Error" - KeyVaultStatusInUse KeyVaultStatus = "InUse" - KeyVaultStatusUpdating KeyVaultStatus = "Updating" -) - -func PossibleValuesForKeyVaultStatus() []string { - return []string{ - string(KeyVaultStatusCreated), - string(KeyVaultStatusDeleted), - string(KeyVaultStatusError), - string(KeyVaultStatusInUse), - string(KeyVaultStatusUpdating), - } -} - -func (s *KeyVaultStatus) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseKeyVaultStatus(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseKeyVaultStatus(input string) (*KeyVaultStatus, error) { - vals := map[string]KeyVaultStatus{ - "created": KeyVaultStatusCreated, - "deleted": KeyVaultStatusDeleted, - "error": KeyVaultStatusError, - "inuse": KeyVaultStatusInUse, - "updating": KeyVaultStatusUpdating, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := KeyVaultStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go b/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go deleted file mode 100644 index 07a8ef7a579..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappaccounts - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount_test.go deleted file mode 100644 index 0e58b3e4d97..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappaccounts - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountscreateorupdate.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountscreateorupdate.go deleted file mode 100644 index 7d7c0d2ca88..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountscreateorupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsCreateOrUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsCreateOrUpdate ... -func (c NetAppAccountsClient) AccountsCreateOrUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccount) (result AccountsCreateOrUpdateOperationResponse, 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 -} - -// AccountsCreateOrUpdateThenPoll performs AccountsCreateOrUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsCreateOrUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccount) error { - result, err := c.AccountsCreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsCreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsCreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsdelete.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsdelete.go deleted file mode 100644 index ae46b7b061d..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsdelete.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsDelete ... -func (c NetAppAccountsClient) AccountsDelete(ctx context.Context, id NetAppAccountId) (result AccountsDeleteOperationResponse, 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 -} - -// AccountsDeleteThenPoll performs AccountsDelete then polls until it's completed -func (c NetAppAccountsClient) AccountsDeleteThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsget.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsget.go deleted file mode 100644 index 4cc63a91e9f..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappaccounts - -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 AccountsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *NetAppAccount -} - -// AccountsGet ... -func (c NetAppAccountsClient) AccountsGet(ctx context.Context, id NetAppAccountId) (result AccountsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountslist.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountslist.go deleted file mode 100644 index 3f16fbcc847..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountslist.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListCompleteResult struct { - Items []NetAppAccount -} - -// AccountsList ... -func (c NetAppAccountsClient) AccountsList(ctx context.Context, id commonids.ResourceGroupId) (result AccountsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListComplete(ctx context.Context, id commonids.ResourceGroupId) (AccountsListCompleteResult, error) { - return c.AccountsListCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate NetAppAccountOperationPredicate) (result AccountsListCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsList(ctx, id) - if err != nil { - 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 = AccountsListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountslistbysubscription.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountslistbysubscription.go deleted file mode 100644 index 0b66b7c904a..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountslistbysubscription.go +++ /dev/null @@ -1,90 +0,0 @@ -package netappaccounts - -import ( - "context" - "fmt" - "net/http" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" - "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 AccountsListBySubscriptionOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]NetAppAccount -} - -type AccountsListBySubscriptionCompleteResult struct { - Items []NetAppAccount -} - -// AccountsListBySubscription ... -func (c NetAppAccountsClient) AccountsListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result AccountsListBySubscriptionOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/providers/Microsoft.NetApp/netAppAccounts", 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 *[]NetAppAccount `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// AccountsListBySubscriptionComplete retrieves all the results into a single object -func (c NetAppAccountsClient) AccountsListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (AccountsListBySubscriptionCompleteResult, error) { - return c.AccountsListBySubscriptionCompleteMatchingPredicate(ctx, id, NetAppAccountOperationPredicate{}) -} - -// AccountsListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c NetAppAccountsClient) AccountsListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate NetAppAccountOperationPredicate) (result AccountsListBySubscriptionCompleteResult, err error) { - items := make([]NetAppAccount, 0) - - resp, err := c.AccountsListBySubscription(ctx, id) - if err != nil { - 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 = AccountsListBySubscriptionCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsrenewcredentials.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsrenewcredentials.go deleted file mode 100644 index 4d7aca0b151..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsrenewcredentials.go +++ /dev/null @@ -1,70 +0,0 @@ -package netappaccounts - -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 AccountsRenewCredentialsOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsRenewCredentials ... -func (c NetAppAccountsClient) AccountsRenewCredentials(ctx context.Context, id NetAppAccountId) (result AccountsRenewCredentialsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/renewCredentials", 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 -} - -// AccountsRenewCredentialsThenPoll performs AccountsRenewCredentials then polls until it's completed -func (c NetAppAccountsClient) AccountsRenewCredentialsThenPoll(ctx context.Context, id NetAppAccountId) error { - result, err := c.AccountsRenewCredentials(ctx, id) - if err != nil { - return fmt.Errorf("performing AccountsRenewCredentials: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsRenewCredentials: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsupdate.go b/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsupdate.go deleted file mode 100644 index 14d063ae23d..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/method_accountsupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package netappaccounts - -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 AccountsUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// AccountsUpdate ... -func (c NetAppAccountsClient) AccountsUpdate(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) (result AccountsUpdateOperationResponse, 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 -} - -// AccountsUpdateThenPoll performs AccountsUpdate then polls until it's completed -func (c NetAppAccountsClient) AccountsUpdateThenPoll(ctx context.Context, id NetAppAccountId, input NetAppAccountPatch) error { - result, err := c.AccountsUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing AccountsUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after AccountsUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_accountencryption.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_accountencryption.go deleted file mode 100644 index 93f1a662f77..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_accountencryption.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountEncryption struct { - Identity *EncryptionIdentity `json:"identity,omitempty"` - KeySource *KeySource `json:"keySource,omitempty"` - KeyVaultProperties *KeyVaultProperties `json:"keyVaultProperties,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_accountproperties.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_accountproperties.go deleted file mode 100644 index 18428908f56..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_accountproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AccountProperties struct { - ActiveDirectories *[]ActiveDirectory `json:"activeDirectories,omitempty"` - DisableShowmount *bool `json:"disableShowmount,omitempty"` - Encryption *AccountEncryption `json:"encryption,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_activedirectory.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_activedirectory.go deleted file mode 100644 index 81bbf0d2927..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_activedirectory.go +++ /dev/null @@ -1,30 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ActiveDirectory struct { - ActiveDirectoryId *string `json:"activeDirectoryId,omitempty"` - AdName *string `json:"adName,omitempty"` - Administrators *[]string `json:"administrators,omitempty"` - AesEncryption *bool `json:"aesEncryption,omitempty"` - AllowLocalNfsUsersWithLdap *bool `json:"allowLocalNfsUsersWithLdap,omitempty"` - BackupOperators *[]string `json:"backupOperators,omitempty"` - Dns *string `json:"dns,omitempty"` - Domain *string `json:"domain,omitempty"` - EncryptDCConnections *bool `json:"encryptDCConnections,omitempty"` - KdcIP *string `json:"kdcIP,omitempty"` - LdapOverTLS *bool `json:"ldapOverTLS,omitempty"` - LdapSearchScope *LdapSearchScopeOpt `json:"ldapSearchScope,omitempty"` - LdapSigning *bool `json:"ldapSigning,omitempty"` - OrganizationalUnit *string `json:"organizationalUnit,omitempty"` - Password *string `json:"password,omitempty"` - PreferredServersForLdapClient *string `json:"preferredServersForLdapClient,omitempty"` - SecurityOperators *[]string `json:"securityOperators,omitempty"` - ServerRootCACertificate *string `json:"serverRootCACertificate,omitempty"` - Site *string `json:"site,omitempty"` - SmbServerName *string `json:"smbServerName,omitempty"` - Status *ActiveDirectoryStatus `json:"status,omitempty"` - StatusDetails *string `json:"statusDetails,omitempty"` - Username *string `json:"username,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_encryptionidentity.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_encryptionidentity.go deleted file mode 100644 index 50cf4dbf679..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_encryptionidentity.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type EncryptionIdentity struct { - PrincipalId *string `json:"principalId,omitempty"` - UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_keyvaultproperties.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_keyvaultproperties.go deleted file mode 100644 index ac5d8c6afa4..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_keyvaultproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type KeyVaultProperties struct { - KeyName string `json:"keyName"` - KeyVaultId *string `json:"keyVaultId,omitempty"` - KeyVaultResourceId string `json:"keyVaultResourceId"` - KeyVaultUri string `json:"keyVaultUri"` - Status *KeyVaultStatus `json:"status,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_ldapsearchscopeopt.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_ldapsearchscopeopt.go deleted file mode 100644 index c476b0f0875..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_ldapsearchscopeopt.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type LdapSearchScopeOpt struct { - GroupDN *string `json:"groupDN,omitempty"` - GroupMembershipFilter *string `json:"groupMembershipFilter,omitempty"` - UserDN *string `json:"userDN,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccount.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccount.go deleted file mode 100644 index ae38663e126..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccount.go +++ /dev/null @@ -1,21 +0,0 @@ -package netappaccounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccount struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccountpatch.go b/resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccountpatch.go deleted file mode 100644 index 9f24bca3d5a..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/model_netappaccountpatch.go +++ /dev/null @@ -1,18 +0,0 @@ -package netappaccounts - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountPatch struct { - Id *string `json:"id,omitempty"` - Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *AccountProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/predicates.go b/resource-manager/netapp/2022-11-01/netappaccounts/predicates.go deleted file mode 100644 index ad2c0a55483..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -package netappaccounts - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type NetAppAccountOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p NetAppAccountOperationPredicate) Matches(input NetAppAccount) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-11-01/netappaccounts/version.go b/resource-manager/netapp/2022-11-01/netappaccounts/version.go deleted file mode 100644 index b9aebedb7da..00000000000 --- a/resource-manager/netapp/2022-11-01/netappaccounts/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappaccounts - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappaccounts/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/README.md b/resource-manager/netapp/2022-11-01/netappresource/README.md deleted file mode 100644 index 9102d61704c..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/README.md +++ /dev/null @@ -1,131 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/netappresource` Documentation - -The `netappresource` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/netappresource" -``` - - -### Client Initialization - -```go -client := netappresource.NewNetAppResourceClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `NetAppResourceClient.CheckFilePathAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.FilePathAvailabilityRequest{ - // ... -} - - -read, err := client.CheckFilePathAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckNameAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.ResourceNameAvailabilityRequest{ - // ... -} - - -read, err := client.CheckNameAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.CheckQuotaAvailability` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -payload := netappresource.QuotaAvailabilityRequest{ - // ... -} - - -read, err := client.CheckQuotaAvailability(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QueryRegionInfo` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QueryRegionInfo(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsGet` - -```go -ctx := context.TODO() -id := netappresource.NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - -read, err := client.QuotaLimitsGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `NetAppResourceClient.QuotaLimitsList` - -```go -ctx := context.TODO() -id := netappresource.NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - -read, err := client.QuotaLimitsList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01/netappresource/client.go b/resource-manager/netapp/2022-11-01/netappresource/client.go deleted file mode 100644 index e02988617d8..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package netappresource - -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 NetAppResourceClient struct { - Client *resourcemanager.Client -} - -func NewNetAppResourceClientWithBaseURI(sdkApi sdkEnv.Api) (*NetAppResourceClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "netappresource", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating NetAppResourceClient: %+v", err) - } - - return &NetAppResourceClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/constants.go b/resource-manager/netapp/2022-11-01/netappresource/constants.go deleted file mode 100644 index c87183e60b6..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/constants.go +++ /dev/null @@ -1,204 +0,0 @@ -package netappresource - -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 CheckNameResourceTypes string - -const ( - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckNameResourceTypes() []string { - return []string{ - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckNameResourceTypes(input string) (*CheckNameResourceTypes, error) { - vals := map[string]CheckNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckNameResourceTypes(input) - return &out, nil -} - -type CheckQuotaNameResourceTypes string - -const ( - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" - CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots CheckQuotaNameResourceTypes = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -) - -func PossibleValuesForCheckQuotaNameResourceTypes() []string { - return []string{ - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes), - string(CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots), - } -} - -func (s *CheckQuotaNameResourceTypes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseCheckQuotaNameResourceTypes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseCheckQuotaNameResourceTypes(input string) (*CheckQuotaNameResourceTypes, error) { - vals := map[string]CheckQuotaNameResourceTypes{ - "microsoft.netapp/netappaccounts": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccounts, - "microsoft.netapp/netappaccounts/capacitypools": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPools, - "microsoft.netapp/netappaccounts/capacitypools/volumes": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumes, - "microsoft.netapp/netappaccounts/capacitypools/volumes/snapshots": CheckQuotaNameResourceTypesMicrosoftPointNetAppNetAppAccountsCapacityPoolsVolumesSnapshots, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := CheckQuotaNameResourceTypes(input) - return &out, nil -} - -type InAvailabilityReasonType string - -const ( - InAvailabilityReasonTypeAlreadyExists InAvailabilityReasonType = "AlreadyExists" - InAvailabilityReasonTypeInvalid InAvailabilityReasonType = "Invalid" -) - -func PossibleValuesForInAvailabilityReasonType() []string { - return []string{ - string(InAvailabilityReasonTypeAlreadyExists), - string(InAvailabilityReasonTypeInvalid), - } -} - -func (s *InAvailabilityReasonType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseInAvailabilityReasonType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseInAvailabilityReasonType(input string) (*InAvailabilityReasonType, error) { - vals := map[string]InAvailabilityReasonType{ - "alreadyexists": InAvailabilityReasonTypeAlreadyExists, - "invalid": InAvailabilityReasonTypeInvalid, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := InAvailabilityReasonType(input) - return &out, nil -} - -type RegionStorageToNetworkProximity string - -const ( - RegionStorageToNetworkProximityAcrossTTwo RegionStorageToNetworkProximity = "AcrossT2" - RegionStorageToNetworkProximityDefault RegionStorageToNetworkProximity = "Default" - RegionStorageToNetworkProximityTOne RegionStorageToNetworkProximity = "T1" - RegionStorageToNetworkProximityTOneAndAcrossTTwo RegionStorageToNetworkProximity = "T1AndAcrossT2" - RegionStorageToNetworkProximityTOneAndTTwo RegionStorageToNetworkProximity = "T1AndT2" - RegionStorageToNetworkProximityTOneAndTTwoAndAcrossTTwo RegionStorageToNetworkProximity = "T1AndT2AndAcrossT2" - RegionStorageToNetworkProximityTTwo RegionStorageToNetworkProximity = "T2" - RegionStorageToNetworkProximityTTwoAndAcrossTTwo RegionStorageToNetworkProximity = "T2AndAcrossT2" -) - -func PossibleValuesForRegionStorageToNetworkProximity() []string { - return []string{ - string(RegionStorageToNetworkProximityAcrossTTwo), - string(RegionStorageToNetworkProximityDefault), - string(RegionStorageToNetworkProximityTOne), - string(RegionStorageToNetworkProximityTOneAndAcrossTTwo), - string(RegionStorageToNetworkProximityTOneAndTTwo), - string(RegionStorageToNetworkProximityTOneAndTTwoAndAcrossTTwo), - string(RegionStorageToNetworkProximityTTwo), - string(RegionStorageToNetworkProximityTTwoAndAcrossTTwo), - } -} - -func (s *RegionStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseRegionStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseRegionStorageToNetworkProximity(input string) (*RegionStorageToNetworkProximity, error) { - vals := map[string]RegionStorageToNetworkProximity{ - "acrosst2": RegionStorageToNetworkProximityAcrossTTwo, - "default": RegionStorageToNetworkProximityDefault, - "t1": RegionStorageToNetworkProximityTOne, - "t1andacrosst2": RegionStorageToNetworkProximityTOneAndAcrossTTwo, - "t1andt2": RegionStorageToNetworkProximityTOneAndTTwo, - "t1andt2andacrosst2": RegionStorageToNetworkProximityTOneAndTTwoAndAcrossTTwo, - "t2": RegionStorageToNetworkProximityTTwo, - "t2andacrosst2": RegionStorageToNetworkProximityTTwoAndAcrossTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RegionStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/id_location.go b/resource-manager/netapp/2022-11-01/netappresource/id_location.go deleted file mode 100644 index 7c120e2a191..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/id_location.go +++ /dev/null @@ -1,116 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -// LocationId is a struct representing the Resource ID for a Location -type LocationId struct { - SubscriptionId string - LocationName string -} - -// NewLocationID returns a new LocationId struct -func NewLocationID(subscriptionId string, locationName string) LocationId { - return LocationId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - } -} - -// ParseLocationID parses 'input' into a LocationId -func ParseLocationID(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseLocationIDInsensitively parses 'input' case-insensitively into a LocationId -// note: this method should only be used for API response data and not user input -func ParseLocationIDInsensitively(input string) (*LocationId, error) { - parser := resourceids.NewParserFromResourceIdType(LocationId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := LocationId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *LocationId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - return nil -} - -// ValidateLocationID checks that 'input' can be parsed as a Location ID -func ValidateLocationID(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 := ParseLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Location ID -func (id LocationId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Location ID -func (id LocationId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - } -} - -// String returns a human-readable description of this Location ID -func (id LocationId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - } - return fmt.Sprintf("Location (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/id_location_test.go b/resource-manager/netapp/2022-11-01/netappresource/id_location_test.go deleted file mode 100644 index 37beb10bbc3..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/id_location_test.go +++ /dev/null @@ -1,237 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = LocationId{} - -func TestNewLocationID(t *testing.T) { - id := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } -} - -func TestFormatLocationID(t *testing.T) { - actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseLocationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestParseLocationIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LocationId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Expected: &LocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseLocationIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - } -} - -func TestSegmentsForLocationId(t *testing.T) { - segments := LocationId{}.Segments() - if len(segments) == 0 { - t.Fatalf("LocationId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go b/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go deleted file mode 100644 index aa29f073d5d..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit.go +++ /dev/null @@ -1,125 +0,0 @@ -package netappresource - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -// QuotaLimitId is a struct representing the Resource ID for a Quota Limit -type QuotaLimitId struct { - SubscriptionId string - LocationName string - QuotaLimitName string -} - -// NewQuotaLimitID returns a new QuotaLimitId struct -func NewQuotaLimitID(subscriptionId string, locationName string, quotaLimitName string) QuotaLimitId { - return QuotaLimitId{ - SubscriptionId: subscriptionId, - LocationName: locationName, - QuotaLimitName: quotaLimitName, - } -} - -// ParseQuotaLimitID parses 'input' into a QuotaLimitId -func ParseQuotaLimitID(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseQuotaLimitIDInsensitively parses 'input' case-insensitively into a QuotaLimitId -// note: this method should only be used for API response data and not user input -func ParseQuotaLimitIDInsensitively(input string) (*QuotaLimitId, error) { - parser := resourceids.NewParserFromResourceIdType(QuotaLimitId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := QuotaLimitId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *QuotaLimitId) FromParseResult(input resourceids.ParseResult) error { - var ok bool - - if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) - } - - if id.LocationName, ok = input.Parsed["locationName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "locationName", input) - } - - if id.QuotaLimitName, ok = input.Parsed["quotaLimitName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "quotaLimitName", input) - } - - return nil -} - -// ValidateQuotaLimitID checks that 'input' can be parsed as a Quota Limit ID -func ValidateQuotaLimitID(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 := ParseQuotaLimitID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Quota Limit ID -func (id QuotaLimitId) ID() string { - fmtString := "/subscriptions/%s/providers/Microsoft.NetApp/locations/%s/quotaLimits/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.QuotaLimitName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Quota Limit ID -func (id QuotaLimitId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticLocations", "locations", "locations"), - resourceids.UserSpecifiedSegment("locationName", "locationValue"), - resourceids.StaticSegment("staticQuotaLimits", "quotaLimits", "quotaLimits"), - resourceids.UserSpecifiedSegment("quotaLimitName", "quotaLimitValue"), - } -} - -// String returns a human-readable description of this Quota Limit ID -func (id QuotaLimitId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Location Name: %q", id.LocationName), - fmt.Sprintf("Quota Limit Name: %q", id.QuotaLimitName), - } - return fmt.Sprintf("Quota Limit (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit_test.go b/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit_test.go deleted file mode 100644 index ca3050d8d70..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/id_quotalimit_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package netappresource - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = QuotaLimitId{} - -func TestNewQuotaLimitID(t *testing.T) { - id := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.LocationName != "locationValue" { - t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationValue") - } - - if id.QuotaLimitName != "quotaLimitValue" { - t.Fatalf("Expected %q but got %q for Segment 'QuotaLimitName'", id.QuotaLimitName, "quotaLimitValue") - } -} - -func TestFormatQuotaLimitID(t *testing.T) { - actual := NewQuotaLimitID("12345678-1234-9876-4563-123456789012", "locationValue", "quotaLimitValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseQuotaLimitID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestParseQuotaLimitIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *QuotaLimitId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "locationValue", - QuotaLimitName: "quotaLimitValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.NetApp/locations/locationValue/quotaLimits/quotaLimitValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe", - Expected: &QuotaLimitId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - LocationName: "lOcAtIoNvAlUe", - QuotaLimitName: "qUoTaLiMiTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.nEtApP/lOcAtIoNs/lOcAtIoNvAlUe/qUoTaLiMiTs/qUoTaLiMiTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseQuotaLimitIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.LocationName != v.Expected.LocationName { - t.Fatalf("Expected %q but got %q for LocationName", v.Expected.LocationName, actual.LocationName) - } - - if actual.QuotaLimitName != v.Expected.QuotaLimitName { - t.Fatalf("Expected %q but got %q for QuotaLimitName", v.Expected.QuotaLimitName, actual.QuotaLimitName) - } - - } -} - -func TestSegmentsForQuotaLimitId(t *testing.T) { - segments := QuotaLimitId{}.Segments() - if len(segments) == 0 { - t.Fatalf("QuotaLimitId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/method_checkfilepathavailability.go b/resource-manager/netapp/2022-11-01/netappresource/method_checkfilepathavailability.go deleted file mode 100644 index ccaafd95a81..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/method_checkfilepathavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckFilePathAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckFilePathAvailability ... -func (c NetAppResourceClient) CheckFilePathAvailability(ctx context.Context, id LocationId, input FilePathAvailabilityRequest) (result CheckFilePathAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkFilePathAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/method_checknameavailability.go b/resource-manager/netapp/2022-11-01/netappresource/method_checknameavailability.go deleted file mode 100644 index 277efaba606..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/method_checknameavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckNameAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckNameAvailability ... -func (c NetAppResourceClient) CheckNameAvailability(ctx context.Context, id LocationId, input ResourceNameAvailabilityRequest) (result CheckNameAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkNameAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/method_checkquotaavailability.go b/resource-manager/netapp/2022-11-01/netappresource/method_checkquotaavailability.go deleted file mode 100644 index e332f8c761b..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/method_checkquotaavailability.go +++ /dev/null @@ -1,56 +0,0 @@ -package netappresource - -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 CheckQuotaAvailabilityOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *CheckAvailabilityResponse -} - -// CheckQuotaAvailability ... -func (c NetAppResourceClient) CheckQuotaAvailability(ctx context.Context, id LocationId, input QuotaAvailabilityRequest) (result CheckQuotaAvailabilityOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/checkQuotaAvailability", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/method_queryregioninfo.go b/resource-manager/netapp/2022-11-01/netappresource/method_queryregioninfo.go deleted file mode 100644 index bce1ced7640..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/method_queryregioninfo.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QueryRegionInfoOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RegionInfo -} - -// QueryRegionInfo ... -func (c NetAppResourceClient) QueryRegionInfo(ctx context.Context, id LocationId) (result QueryRegionInfoOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/regionInfo", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/method_quotalimitsget.go b/resource-manager/netapp/2022-11-01/netappresource/method_quotalimitsget.go deleted file mode 100644 index 2b566bfa762..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/method_quotalimitsget.go +++ /dev/null @@ -1,51 +0,0 @@ -package netappresource - -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 QuotaLimitsGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItem -} - -// QuotaLimitsGet ... -func (c NetAppResourceClient) QuotaLimitsGet(ctx context.Context, id QuotaLimitId) (result QuotaLimitsGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/method_quotalimitslist.go b/resource-manager/netapp/2022-11-01/netappresource/method_quotalimitslist.go deleted file mode 100644 index e7dcec4cc4e..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/method_quotalimitslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package netappresource - -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 QuotaLimitsListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SubscriptionQuotaItemList -} - -// QuotaLimitsList ... -func (c NetAppResourceClient) QuotaLimitsList(ctx context.Context, id LocationId) (result QuotaLimitsListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/quotaLimits", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_checkavailabilityresponse.go b/resource-manager/netapp/2022-11-01/netappresource/model_checkavailabilityresponse.go deleted file mode 100644 index 6423d9de076..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_checkavailabilityresponse.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type CheckAvailabilityResponse struct { - IsAvailable *bool `json:"isAvailable,omitempty"` - Message *string `json:"message,omitempty"` - Reason *InAvailabilityReasonType `json:"reason,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_filepathavailabilityrequest.go b/resource-manager/netapp/2022-11-01/netappresource/model_filepathavailabilityrequest.go deleted file mode 100644 index 6407d29060b..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_filepathavailabilityrequest.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type FilePathAvailabilityRequest struct { - Name string `json:"name"` - SubnetId string `json:"subnetId"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_quotaavailabilityrequest.go b/resource-manager/netapp/2022-11-01/netappresource/model_quotaavailabilityrequest.go deleted file mode 100644 index d8df9ac4cef..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_quotaavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type QuotaAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckQuotaNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_regioninfo.go b/resource-manager/netapp/2022-11-01/netappresource/model_regioninfo.go deleted file mode 100644 index 63c92a72c98..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_regioninfo.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfo struct { - AvailabilityZoneMappings *[]RegionInfoAvailabilityZoneMappingsInlined `json:"availabilityZoneMappings,omitempty"` - StorageToNetworkProximity *RegionStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go b/resource-manager/netapp/2022-11-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go deleted file mode 100644 index 36fce7489dc..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_regioninfoavailabilityzonemappingsinlined.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RegionInfoAvailabilityZoneMappingsInlined struct { - AvailabilityZone *string `json:"availabilityZone,omitempty"` - IsAvailable *bool `json:"isAvailable,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_resourcenameavailabilityrequest.go b/resource-manager/netapp/2022-11-01/netappresource/model_resourcenameavailabilityrequest.go deleted file mode 100644 index 0bfbaf4c0e9..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_resourcenameavailabilityrequest.go +++ /dev/null @@ -1,10 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ResourceNameAvailabilityRequest struct { - Name string `json:"name"` - ResourceGroup string `json:"resourceGroup"` - Type CheckNameResourceTypes `json:"type"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitem.go b/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitem.go deleted file mode 100644 index 88a5cbd39c1..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitem.go +++ /dev/null @@ -1,16 +0,0 @@ -package netappresource - -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 SubscriptionQuotaItem struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubscriptionQuotaItemProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemlist.go b/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemlist.go deleted file mode 100644 index 800319869a1..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemlist.go +++ /dev/null @@ -1,8 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemList struct { - Value *[]SubscriptionQuotaItem `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemproperties.go b/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemproperties.go deleted file mode 100644 index 01cdd538c05..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/model_subscriptionquotaitemproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package netappresource - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubscriptionQuotaItemProperties struct { - Current *int64 `json:"current,omitempty"` - Default *int64 `json:"default,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/netappresource/version.go b/resource-manager/netapp/2022-11-01/netappresource/version.go deleted file mode 100644 index 2cf4f0a306a..00000000000 --- a/resource-manager/netapp/2022-11-01/netappresource/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package netappresource - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/netappresource/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/poolchange/README.md b/resource-manager/netapp/2022-11-01/poolchange/README.md deleted file mode 100644 index c96fa9dd9f1..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/poolchange` Documentation - -The `poolchange` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/poolchange" -``` - - -### Client Initialization - -```go -client := poolchange.NewPoolChangeClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `PoolChangeClient.VolumesPoolChange` - -```go -ctx := context.TODO() -id := poolchange.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := poolchange.PoolChangeRequest{ - // ... -} - - -if err := client.VolumesPoolChangeThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/poolchange/client.go b/resource-manager/netapp/2022-11-01/poolchange/client.go deleted file mode 100644 index 270c25028c2..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package poolchange - -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 PoolChangeClient struct { - Client *resourcemanager.Client -} - -func NewPoolChangeClientWithBaseURI(sdkApi sdkEnv.Api) (*PoolChangeClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "poolchange", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating PoolChangeClient: %+v", err) - } - - return &PoolChangeClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/poolchange/id_volume.go b/resource-manager/netapp/2022-11-01/poolchange/id_volume.go deleted file mode 100644 index 60065ac10ae..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package poolchange - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/poolchange/id_volume_test.go b/resource-manager/netapp/2022-11-01/poolchange/id_volume_test.go deleted file mode 100644 index 496e8bbcaad..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package poolchange - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/poolchange/method_volumespoolchange.go b/resource-manager/netapp/2022-11-01/poolchange/method_volumespoolchange.go deleted file mode 100644 index 7a0ca0e6450..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/method_volumespoolchange.go +++ /dev/null @@ -1,74 +0,0 @@ -package poolchange - -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 VolumesPoolChangeOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesPoolChange ... -func (c PoolChangeClient) VolumesPoolChange(ctx context.Context, id VolumeId, input PoolChangeRequest) (result VolumesPoolChangeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/poolChange", 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 -} - -// VolumesPoolChangeThenPoll performs VolumesPoolChange then polls until it's completed -func (c PoolChangeClient) VolumesPoolChangeThenPoll(ctx context.Context, id VolumeId, input PoolChangeRequest) error { - result, err := c.VolumesPoolChange(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesPoolChange: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesPoolChange: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/poolchange/model_poolchangerequest.go b/resource-manager/netapp/2022-11-01/poolchange/model_poolchangerequest.go deleted file mode 100644 index 19402a5b699..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/model_poolchangerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package poolchange - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PoolChangeRequest struct { - NewPoolResourceId string `json:"newPoolResourceId"` -} diff --git a/resource-manager/netapp/2022-11-01/poolchange/version.go b/resource-manager/netapp/2022-11-01/poolchange/version.go deleted file mode 100644 index 5932178e3cf..00000000000 --- a/resource-manager/netapp/2022-11-01/poolchange/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package poolchange - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/poolchange/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/resetcifspassword/client.go b/resource-manager/netapp/2022-11-01/resetcifspassword/client.go deleted file mode 100644 index 2d17ccc3976..00000000000 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package resetcifspassword - -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 ResetCifsPasswordClient struct { - Client *resourcemanager.Client -} - -func NewResetCifsPasswordClientWithBaseURI(sdkApi sdkEnv.Api) (*ResetCifsPasswordClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "resetcifspassword", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating ResetCifsPasswordClient: %+v", err) - } - - return &ResetCifsPasswordClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go b/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go deleted file mode 100644 index 69421cfe5d9..00000000000 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package resetcifspassword - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume_test.go b/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume_test.go deleted file mode 100644 index 9b41608cce7..00000000000 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package resetcifspassword - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/resetcifspassword/method_volumesresetcifspassword.go b/resource-manager/netapp/2022-11-01/resetcifspassword/method_volumesresetcifspassword.go deleted file mode 100644 index ca6d379fdfc..00000000000 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/method_volumesresetcifspassword.go +++ /dev/null @@ -1,70 +0,0 @@ -package resetcifspassword - -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 VolumesResetCifsPasswordOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResetCifsPassword ... -func (c ResetCifsPasswordClient) VolumesResetCifsPassword(ctx context.Context, id VolumeId) (result VolumesResetCifsPasswordOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resetCifsPassword", 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 -} - -// VolumesResetCifsPasswordThenPoll performs VolumesResetCifsPassword then polls until it's completed -func (c ResetCifsPasswordClient) VolumesResetCifsPasswordThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResetCifsPassword(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResetCifsPassword: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResetCifsPassword: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/resetcifspassword/version.go b/resource-manager/netapp/2022-11-01/resetcifspassword/version.go deleted file mode 100644 index fa06f2ca309..00000000000 --- a/resource-manager/netapp/2022-11-01/resetcifspassword/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package resetcifspassword - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/resetcifspassword/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/restore/README.md b/resource-manager/netapp/2022-11-01/restore/README.md deleted file mode 100644 index 747d9803faf..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/restore` Documentation - -The `restore` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/restore" -``` - - -### Client Initialization - -```go -client := restore.NewRestoreClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `RestoreClient.BackupsGetVolumeRestoreStatus` - -```go -ctx := context.TODO() -id := restore.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.BackupsGetVolumeRestoreStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01/restore/client.go b/resource-manager/netapp/2022-11-01/restore/client.go deleted file mode 100644 index 97fa355d7db..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package restore - -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 RestoreClient struct { - Client *resourcemanager.Client -} - -func NewRestoreClientWithBaseURI(sdkApi sdkEnv.Api) (*RestoreClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "restore", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating RestoreClient: %+v", err) - } - - return &RestoreClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/restore/constants.go b/resource-manager/netapp/2022-11-01/restore/constants.go deleted file mode 100644 index 9eea259cd41..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/constants.go +++ /dev/null @@ -1,95 +0,0 @@ -package restore - -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 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/restore/id_volume.go b/resource-manager/netapp/2022-11-01/restore/id_volume.go deleted file mode 100644 index 46089747e17..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package restore - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/restore/id_volume_test.go b/resource-manager/netapp/2022-11-01/restore/id_volume_test.go deleted file mode 100644 index 2f07b6ef48e..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package restore - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/restore/method_backupsgetvolumerestorestatus.go b/resource-manager/netapp/2022-11-01/restore/method_backupsgetvolumerestorestatus.go deleted file mode 100644 index 47f85cfa0ce..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/method_backupsgetvolumerestorestatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package restore - -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 BackupsGetVolumeRestoreStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *RestoreStatus -} - -// BackupsGetVolumeRestoreStatus ... -func (c RestoreClient) BackupsGetVolumeRestoreStatus(ctx context.Context, id VolumeId) (result BackupsGetVolumeRestoreStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/restoreStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/restore/model_restorestatus.go b/resource-manager/netapp/2022-11-01/restore/model_restorestatus.go deleted file mode 100644 index 546d31e9ce7..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/model_restorestatus.go +++ /dev/null @@ -1,13 +0,0 @@ -package restore - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RestoreStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalTransferBytes *int64 `json:"totalTransferBytes,omitempty"` - UnhealthyReason *string `json:"unhealthyReason,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/restore/version.go b/resource-manager/netapp/2022-11-01/restore/version.go deleted file mode 100644 index d783cfb8ef6..00000000000 --- a/resource-manager/netapp/2022-11-01/restore/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package restore - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/restore/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/README.md b/resource-manager/netapp/2022-11-01/snapshotpolicy/README.md deleted file mode 100644 index 9906fe834b6..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/README.md +++ /dev/null @@ -1,102 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/snapshotpolicy` Documentation - -The `snapshotpolicy` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/snapshotpolicy" -``` - - -### Client Initialization - -```go -client := snapshotpolicy.NewSnapshotPolicyClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesCreate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicy{ - // ... -} - - -read, err := client.SnapshotPoliciesCreate(ctx, id, payload) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesDelete` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -if err := client.SnapshotPoliciesDeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesGet` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesGet(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesList` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.SnapshotPoliciesList(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotPolicyClient.SnapshotPoliciesUpdate` - -```go -ctx := context.TODO() -id := snapshotpolicy.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -payload := snapshotpolicy.SnapshotPolicyPatch{ - // ... -} - - -if err := client.SnapshotPoliciesUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go deleted file mode 100644 index eebb8c7b8da..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicy - -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 SnapshotPolicyClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicy", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyClient: %+v", err) - } - - return &SnapshotPolicyClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go deleted file mode 100644 index 162b7094379..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount_test.go deleted file mode 100644 index c181f6cd7cd..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go deleted file mode 100644 index 3daea71a654..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicy - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy_test.go deleted file mode 100644 index b3f070cc0f2..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicy - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciescreate.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciescreate.go deleted file mode 100644 index 8a1724f9e0d..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciescreate.go +++ /dev/null @@ -1,56 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesCreateOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesCreate ... -func (c SnapshotPolicyClient) SnapshotPoliciesCreate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicy) (result SnapshotPoliciesCreateOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesdelete.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesdelete.go deleted file mode 100644 index 88822a15bf8..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesdelete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesDeleteOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesDelete ... -func (c SnapshotPolicyClient) SnapshotPoliciesDelete(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesDeleteOperationResponse, 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 -} - -// SnapshotPoliciesDeleteThenPoll performs SnapshotPoliciesDelete then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesDeleteThenPoll(ctx context.Context, id SnapshotPolicyId) error { - result, err := c.SnapshotPoliciesDelete(ctx, id) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesDelete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesDelete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesget.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesget.go deleted file mode 100644 index ebb812f1ffb..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesget.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesGetOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicy -} - -// SnapshotPoliciesGet ... -func (c SnapshotPolicyClient) SnapshotPoliciesGet(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesGetOperationResponse, 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpolicieslist.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpolicieslist.go deleted file mode 100644 index bec4c8146b3..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpolicieslist.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPoliciesList -} - -// SnapshotPoliciesList ... -func (c SnapshotPolicyClient) SnapshotPoliciesList(ctx context.Context, id NetAppAccountId) (result SnapshotPoliciesListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshotPolicies", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesupdate.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesupdate.go deleted file mode 100644 index 46bf5bd6f56..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/method_snapshotpoliciesupdate.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshotpolicy - -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 SnapshotPoliciesUpdateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// SnapshotPoliciesUpdate ... -func (c SnapshotPolicyClient) SnapshotPoliciesUpdate(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) (result SnapshotPoliciesUpdateOperationResponse, 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 -} - -// SnapshotPoliciesUpdateThenPoll performs SnapshotPoliciesUpdate then polls until it's completed -func (c SnapshotPolicyClient) SnapshotPoliciesUpdateThenPoll(ctx context.Context, id SnapshotPolicyId, input SnapshotPolicyPatch) error { - result, err := c.SnapshotPoliciesUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing SnapshotPoliciesUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after SnapshotPoliciesUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_dailyschedule.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_dailyschedule.go deleted file mode 100644 index bdafb72e6e0..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_dailyschedule.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type DailySchedule struct { - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_hourlyschedule.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_hourlyschedule.go deleted file mode 100644 index a1e5d0fa028..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_hourlyschedule.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type HourlySchedule struct { - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_monthlyschedule.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_monthlyschedule.go deleted file mode 100644 index 02cbcad6a59..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_monthlyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MonthlySchedule struct { - DaysOfMonth *string `json:"daysOfMonth,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicieslist.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicieslist.go deleted file mode 100644 index 910e2519adb..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicieslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPoliciesList struct { - Value *[]SnapshotPolicy `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicy.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicy.go deleted file mode 100644 index 310cfaaf1bb..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicy.go +++ /dev/null @@ -1,19 +0,0 @@ -package snapshotpolicy - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicy struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties SnapshotPolicyProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicypatch.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicypatch.go deleted file mode 100644 index 76df9be172b..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicypatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyPatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SnapshotPolicyProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicyproperties.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicyproperties.go deleted file mode 100644 index fb4fb0fcb05..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_snapshotpolicyproperties.go +++ /dev/null @@ -1,13 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyProperties struct { - DailySchedule *DailySchedule `json:"dailySchedule,omitempty"` - Enabled *bool `json:"enabled,omitempty"` - HourlySchedule *HourlySchedule `json:"hourlySchedule,omitempty"` - MonthlySchedule *MonthlySchedule `json:"monthlySchedule,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - WeeklySchedule *WeeklySchedule `json:"weeklySchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_weeklyschedule.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/model_weeklyschedule.go deleted file mode 100644 index 128ece7ef5e..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/model_weeklyschedule.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type WeeklySchedule struct { - Day *string `json:"day,omitempty"` - Hour *int64 `json:"hour,omitempty"` - Minute *int64 `json:"minute,omitempty"` - SnapshotsToKeep *int64 `json:"snapshotsToKeep,omitempty"` - UsedBytes *int64 `json:"usedBytes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicy/version.go b/resource-manager/netapp/2022-11-01/snapshotpolicy/version.go deleted file mode 100644 index a0cf677d39f..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicy/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicy - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicy/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/README.md b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/README.md deleted file mode 100644 index 2b6c9f2ac35..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/README.md +++ /dev/null @@ -1,36 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes` Documentation - -The `snapshotpolicylistvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/snapshotpolicylistvolumes" -``` - - -### Client Initialization - -```go -client := snapshotpolicylistvolumes.NewSnapshotPolicyListVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotPolicyListVolumesClient.SnapshotPoliciesListVolumes` - -```go -ctx := context.TODO() -id := snapshotpolicylistvolumes.NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - -read, err := client.SnapshotPoliciesListVolumes(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go deleted file mode 100644 index 047d79a12c3..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPolicyListVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotPolicyListVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotPolicyListVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshotpolicylistvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotPolicyListVolumesClient: %+v", err) - } - - return &SnapshotPolicyListVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/constants.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/constants.go deleted file mode 100644 index 1a0d5a1a245..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/constants.go +++ /dev/null @@ -1,558 +0,0 @@ -package snapshotpolicylistvolumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityAcrossTTwo VolumeStorageToNetworkProximity = "AcrossT2" - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityAcrossTTwo), - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "acrosst2": VolumeStorageToNetworkProximityAcrossTTwo, - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go deleted file mode 100644 index 37d159192cf..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy.go +++ /dev/null @@ -1,134 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -// SnapshotPolicyId is a struct representing the Resource ID for a Snapshot Policy -type SnapshotPolicyId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - SnapshotPolicyName string -} - -// NewSnapshotPolicyID returns a new SnapshotPolicyId struct -func NewSnapshotPolicyID(subscriptionId string, resourceGroupName string, netAppAccountName string, snapshotPolicyName string) SnapshotPolicyId { - return SnapshotPolicyId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - SnapshotPolicyName: snapshotPolicyName, - } -} - -// ParseSnapshotPolicyID parses 'input' into a SnapshotPolicyId -func ParseSnapshotPolicyID(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotPolicyIDInsensitively parses 'input' case-insensitively into a SnapshotPolicyId -// note: this method should only be used for API response data and not user input -func ParseSnapshotPolicyIDInsensitively(input string) (*SnapshotPolicyId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotPolicyId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotPolicyId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotPolicyId) 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.SnapshotPolicyName, ok = input.Parsed["snapshotPolicyName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotPolicyName", input) - } - - return nil -} - -// ValidateSnapshotPolicyID checks that 'input' can be parsed as a Snapshot Policy ID -func ValidateSnapshotPolicyID(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 := ParseSnapshotPolicyID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot Policy ID -func (id SnapshotPolicyId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/snapshotPolicies/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.SnapshotPolicyName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot Policy ID -func (id SnapshotPolicyId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticSnapshotPolicies", "snapshotPolicies", "snapshotPolicies"), - resourceids.UserSpecifiedSegment("snapshotPolicyName", "snapshotPolicyValue"), - } -} - -// String returns a human-readable description of this Snapshot Policy ID -func (id SnapshotPolicyId) 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("Snapshot Policy Name: %q", id.SnapshotPolicyName), - } - return fmt.Sprintf("Snapshot Policy (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go deleted file mode 100644 index b7b4ebfa73a..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/id_snapshotpolicy_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotPolicyId{} - -func TestNewSnapshotPolicyID(t *testing.T) { - id := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.SnapshotPolicyName != "snapshotPolicyValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotPolicyName'", id.SnapshotPolicyName, "snapshotPolicyValue") - } -} - -func TestFormatSnapshotPolicyID(t *testing.T) { - actual := NewSnapshotPolicyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "snapshotPolicyValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotPolicyID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestParseSnapshotPolicyIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotPolicyId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - SnapshotPolicyName: "snapshotPolicyValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/snapshotPolicies/snapshotPolicyValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe", - Expected: &SnapshotPolicyId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - SnapshotPolicyName: "sNaPsHoTpOlIcYvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/sNaPsHoTpOlIcIeS/sNaPsHoTpOlIcYvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotPolicyIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.SnapshotPolicyName != v.Expected.SnapshotPolicyName { - t.Fatalf("Expected %q but got %q for SnapshotPolicyName", v.Expected.SnapshotPolicyName, actual.SnapshotPolicyName) - } - - } -} - -func TestSegmentsForSnapshotPolicyId(t *testing.T) { - segments := SnapshotPolicyId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotPolicyId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go deleted file mode 100644 index 95000d4db93..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/method_snapshotpolicieslistvolumes.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshotpolicylistvolumes - -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 SnapshotPoliciesListVolumesOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotPolicyVolumeList -} - -// SnapshotPoliciesListVolumes ... -func (c SnapshotPolicyListVolumesClient) SnapshotPoliciesListVolumes(ctx context.Context, id SnapshotPolicyId) (result SnapshotPoliciesListVolumesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_exportpolicyrule.go deleted file mode 100644 index dd6bb7a20fc..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_mounttargetproperties.go deleted file mode 100644 index 49f9f6f131a..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 0d5756a7089..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_replicationobject.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_replicationobject.go deleted file mode 100644 index 97bf50ea504..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go deleted file mode 100644 index 2d14e9596fe..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_snapshotpolicyvolumelist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotPolicyVolumeList struct { - Value *[]Volume `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volume.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volume.go deleted file mode 100644 index 36417f52891..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package snapshotpolicylistvolumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumebackupproperties.go deleted file mode 100644 index e8fc89d03c8..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumebackupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumeproperties.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumeproperties.go deleted file mode 100644 index 309c5236d2a..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumeproperties.go +++ /dev/null @@ -1,60 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - ActualThroughputMibps *float64 `json:"actualThroughputMibps,omitempty"` - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - OriginatingResourceId *string `json:"originatingResourceId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index bf5ff10761d..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` - VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 1ad178d6e25..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go deleted file mode 100644 index 26ffc8f0697..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go deleted file mode 100644 index e4915375144..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshotpolicylistvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/version.go b/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/version.go deleted file mode 100644 index 68fe70a5089..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshotpolicylistvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshotpolicylistvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshotpolicylistvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/README.md b/resource-manager/netapp/2022-11-01/snapshots/README.md deleted file mode 100644 index 8be6c4386bf..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/snapshots` Documentation - -The `snapshots` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/snapshots" -``` - - -### Client Initialization - -```go -client := snapshots.NewSnapshotsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SnapshotsClient.Create` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.Snapshot{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Delete` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Get` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.List` - -```go -ctx := context.TODO() -id := snapshots.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.List(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `SnapshotsClient.RestoreFiles` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - -payload := snapshots.SnapshotRestoreFiles{ - // ... -} - - -if err := client.RestoreFilesThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SnapshotsClient.Update` - -```go -ctx := context.TODO() -id := snapshots.NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") -var payload interface{} - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/snapshots/client.go b/resource-manager/netapp/2022-11-01/snapshots/client.go deleted file mode 100644 index 620b7900eab..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package snapshots - -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 SnapshotsClient struct { - Client *resourcemanager.Client -} - -func NewSnapshotsClientWithBaseURI(sdkApi sdkEnv.Api) (*SnapshotsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "snapshots", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SnapshotsClient: %+v", err) - } - - return &SnapshotsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go b/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go deleted file mode 100644 index 8a20d21ec27..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/id_snapshot.go +++ /dev/null @@ -1,152 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -// SnapshotId is a struct representing the Resource ID for a Snapshot -type SnapshotId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SnapshotName string -} - -// NewSnapshotID returns a new SnapshotId struct -func NewSnapshotID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, snapshotName string) SnapshotId { - return SnapshotId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SnapshotName: snapshotName, - } -} - -// ParseSnapshotID parses 'input' into a SnapshotId -func ParseSnapshotID(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSnapshotIDInsensitively parses 'input' case-insensitively into a SnapshotId -// note: this method should only be used for API response data and not user input -func ParseSnapshotIDInsensitively(input string) (*SnapshotId, error) { - parser := resourceids.NewParserFromResourceIdType(SnapshotId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SnapshotId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SnapshotId) 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) - } - - if id.SnapshotName, ok = input.Parsed["snapshotName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "snapshotName", input) - } - - return nil -} - -// ValidateSnapshotID checks that 'input' can be parsed as a Snapshot ID -func ValidateSnapshotID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseSnapshotID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Snapshot ID -func (id SnapshotId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/snapshots/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SnapshotName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Snapshot ID -func (id SnapshotId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSnapshots", "snapshots", "snapshots"), - resourceids.UserSpecifiedSegment("snapshotName", "snapshotValue"), - } -} - -// String returns a human-readable description of this Snapshot ID -func (id SnapshotId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - fmt.Sprintf("Volume Name: %q", id.VolumeName), - fmt.Sprintf("Snapshot Name: %q", id.SnapshotName), - } - return fmt.Sprintf("Snapshot (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/id_snapshot_test.go b/resource-manager/netapp/2022-11-01/snapshots/id_snapshot_test.go deleted file mode 100644 index 4dd0b44f4a3..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/id_snapshot_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SnapshotId{} - -func TestNewSnapshotID(t *testing.T) { - id := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SnapshotName != "snapshotValue" { - t.Fatalf("Expected %q but got %q for Segment 'SnapshotName'", id.SnapshotName, "snapshotValue") - } -} - -func TestFormatSnapshotID(t *testing.T) { - actual := NewSnapshotID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "snapshotValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSnapshotID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestParseSnapshotIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SnapshotId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SnapshotName: "snapshotValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/snapshots/snapshotValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe", - Expected: &SnapshotId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SnapshotName: "sNaPsHoTvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sNaPsHoTs/sNaPsHoTvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSnapshotIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SnapshotName != v.Expected.SnapshotName { - t.Fatalf("Expected %q but got %q for SnapshotName", v.Expected.SnapshotName, actual.SnapshotName) - } - - } -} - -func TestSegmentsForSnapshotId(t *testing.T) { - segments := SnapshotId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SnapshotId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/id_volume.go b/resource-manager/netapp/2022-11-01/snapshots/id_volume.go deleted file mode 100644 index 06879ea6a3a..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package snapshots - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/snapshots/id_volume_test.go b/resource-manager/netapp/2022-11-01/snapshots/id_volume_test.go deleted file mode 100644 index 6bcb01d8ea1..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package snapshots - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/method_create.go b/resource-manager/netapp/2022-11-01/snapshots/method_create.go deleted file mode 100644 index 1c781284afe..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Create ... -func (c SnapshotsClient) Create(ctx context.Context, id SnapshotId, input Snapshot) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusCreated, - }, - 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 SnapshotsClient) CreateThenPoll(ctx context.Context, id SnapshotId, input Snapshot) error { - result, err := c.Create(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Create: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Create: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/method_delete.go b/resource-manager/netapp/2022-11-01/snapshots/method_delete.go deleted file mode 100644 index ef16480f860..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package snapshots - -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 SnapshotsClient) Delete(ctx context.Context, id SnapshotId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SnapshotsClient) DeleteThenPoll(ctx context.Context, id SnapshotId) error { - result, err := c.Delete(ctx, id) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/method_get.go b/resource-manager/netapp/2022-11-01/snapshots/method_get.go deleted file mode 100644 index 4f024ded473..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package snapshots - -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 *Snapshot -} - -// Get ... -func (c SnapshotsClient) Get(ctx context.Context, id SnapshotId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/method_list.go b/resource-manager/netapp/2022-11-01/snapshots/method_list.go deleted file mode 100644 index f1079759c22..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/method_list.go +++ /dev/null @@ -1,52 +0,0 @@ -package snapshots - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *SnapshotsList -} - -// List ... -func (c SnapshotsClient) List(ctx context.Context, id VolumeId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/snapshots", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/method_restorefiles.go b/resource-manager/netapp/2022-11-01/snapshots/method_restorefiles.go deleted file mode 100644 index 685be44a5ff..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/method_restorefiles.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 RestoreFilesOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// RestoreFiles ... -func (c SnapshotsClient) RestoreFiles(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) (result RestoreFilesOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - 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 -} - -// RestoreFilesThenPoll performs RestoreFiles then polls until it's completed -func (c SnapshotsClient) RestoreFilesThenPoll(ctx context.Context, id SnapshotId, input SnapshotRestoreFiles) error { - result, err := c.RestoreFiles(ctx, id, input) - if err != nil { - return fmt.Errorf("performing RestoreFiles: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after RestoreFiles: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/method_update.go b/resource-manager/netapp/2022-11-01/snapshots/method_update.go deleted file mode 100644 index 656719e61bd..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package snapshots - -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 -} - -// Update ... -func (c SnapshotsClient) Update(ctx context.Context, id SnapshotId, input interface{}) (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 SnapshotsClient) UpdateThenPoll(ctx context.Context, id SnapshotId, input interface{}) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/model_snapshot.go b/resource-manager/netapp/2022-11-01/snapshots/model_snapshot.go deleted file mode 100644 index fe53e779a4c..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/model_snapshot.go +++ /dev/null @@ -1,17 +0,0 @@ -package snapshots - -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 Snapshot struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *SnapshotProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/model_snapshotproperties.go b/resource-manager/netapp/2022-11-01/snapshots/model_snapshotproperties.go deleted file mode 100644 index fe60537eaaa..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/model_snapshotproperties.go +++ /dev/null @@ -1,28 +0,0 @@ -package snapshots - -import ( - "time" - - "github.com/hashicorp/go-azure-helpers/lang/dates" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotProperties struct { - Created *string `json:"created,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` -} - -func (o *SnapshotProperties) GetCreatedAsTime() (*time.Time, error) { - if o.Created == nil { - return nil, nil - } - return dates.ParseAsFormat(o.Created, "2006-01-02T15:04:05Z07:00") -} - -func (o *SnapshotProperties) SetCreatedAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.Created = &formatted -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/model_snapshotrestorefiles.go b/resource-manager/netapp/2022-11-01/snapshots/model_snapshotrestorefiles.go deleted file mode 100644 index de80d971dcf..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/model_snapshotrestorefiles.go +++ /dev/null @@ -1,9 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotRestoreFiles struct { - DestinationPath *string `json:"destinationPath,omitempty"` - FilePaths []string `json:"filePaths"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/model_snapshotslist.go b/resource-manager/netapp/2022-11-01/snapshots/model_snapshotslist.go deleted file mode 100644 index bf283b0d2ac..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/model_snapshotslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package snapshots - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SnapshotsList struct { - Value *[]Snapshot `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/snapshots/version.go b/resource-manager/netapp/2022-11-01/snapshots/version.go deleted file mode 100644 index 2fe2a528227..00000000000 --- a/resource-manager/netapp/2022-11-01/snapshots/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package snapshots - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/snapshots/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/README.md b/resource-manager/netapp/2022-11-01/subvolumes/README.md deleted file mode 100644 index 4bc62628ae1..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/README.md +++ /dev/null @@ -1,111 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/subvolumes` Documentation - -The `subvolumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/subvolumes" -``` - - -### Client Initialization - -```go -client := subvolumes.NewSubVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `SubVolumesClient.Create` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumeInfo{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Delete` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.Get` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -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: `SubVolumesClient.GetMetadata` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -if err := client.GetMetadataThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `SubVolumesClient.ListByVolume` - -```go -ctx := context.TODO() -id := subvolumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -// alternatively `client.ListByVolume(ctx, id)` can be used to do batched pagination -items, err := client.ListByVolumeComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `SubVolumesClient.Update` - -```go -ctx := context.TODO() -id := subvolumes.NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - -payload := subvolumes.SubvolumePatchRequest{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/subvolumes/client.go b/resource-manager/netapp/2022-11-01/subvolumes/client.go deleted file mode 100644 index b675258d906..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package subvolumes - -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 SubVolumesClient struct { - Client *resourcemanager.Client -} - -func NewSubVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*SubVolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "subvolumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating SubVolumesClient: %+v", err) - } - - return &SubVolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go b/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go deleted file mode 100644 index 0649b6aeac0..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume.go +++ /dev/null @@ -1,152 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -// SubVolumeId is a struct representing the Resource ID for a Sub Volume -type SubVolumeId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - SubVolumeName string -} - -// NewSubVolumeID returns a new SubVolumeId struct -func NewSubVolumeID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, subVolumeName string) SubVolumeId { - return SubVolumeId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - SubVolumeName: subVolumeName, - } -} - -// ParseSubVolumeID parses 'input' into a SubVolumeId -func ParseSubVolumeID(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseSubVolumeIDInsensitively parses 'input' case-insensitively into a SubVolumeId -// note: this method should only be used for API response data and not user input -func ParseSubVolumeIDInsensitively(input string) (*SubVolumeId, error) { - parser := resourceids.NewParserFromResourceIdType(SubVolumeId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := SubVolumeId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *SubVolumeId) 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) - } - - if id.SubVolumeName, ok = input.Parsed["subVolumeName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "subVolumeName", input) - } - - return nil -} - -// ValidateSubVolumeID checks that 'input' can be parsed as a Sub Volume ID -func ValidateSubVolumeID(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 := ParseSubVolumeID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Sub Volume ID -func (id SubVolumeId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/subVolumes/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.SubVolumeName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Sub Volume ID -func (id SubVolumeId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticSubVolumes", "subVolumes", "subVolumes"), - resourceids.UserSpecifiedSegment("subVolumeName", "subVolumeValue"), - } -} - -// String returns a human-readable description of this Sub Volume ID -func (id SubVolumeId) 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), - fmt.Sprintf("Sub Volume Name: %q", id.SubVolumeName), - } - return fmt.Sprintf("Sub Volume (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume_test.go b/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume_test.go deleted file mode 100644 index f76df7c9c16..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/id_subvolume_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = SubVolumeId{} - -func TestNewSubVolumeID(t *testing.T) { - id := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.SubVolumeName != "subVolumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'SubVolumeName'", id.SubVolumeName, "subVolumeValue") - } -} - -func TestFormatSubVolumeID(t *testing.T) { - actual := NewSubVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "subVolumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseSubVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestParseSubVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *SubVolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - SubVolumeName: "subVolumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/subVolumes/subVolumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE", - Expected: &SubVolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - SubVolumeName: "sUbVoLuMeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/sUbVoLuMeS/sUbVoLuMeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseSubVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.SubVolumeName != v.Expected.SubVolumeName { - t.Fatalf("Expected %q but got %q for SubVolumeName", v.Expected.SubVolumeName, actual.SubVolumeName) - } - - } -} - -func TestSegmentsForSubVolumeId(t *testing.T) { - segments := SubVolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("SubVolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go b/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go deleted file mode 100644 index 8bbeb6c9e23..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package subvolumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/subvolumes/id_volume_test.go b/resource-manager/netapp/2022-11-01/subvolumes/id_volume_test.go deleted file mode 100644 index 7d4f6c8d6f1..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package subvolumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/method_create.go b/resource-manager/netapp/2022-11-01/subvolumes/method_create.go deleted file mode 100644 index 65a0d34e8d4..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/method_create.go +++ /dev/null @@ -1,75 +0,0 @@ -package subvolumes - -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 -} - -// Create ... -func (c SubVolumesClient) Create(ctx context.Context, id SubVolumeId, input SubvolumeInfo) (result CreateOperationResponse, 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 -} - -// CreateThenPoll performs Create then polls until it's completed -func (c SubVolumesClient) CreateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumeInfo) 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/resource-manager/netapp/2022-11-01/subvolumes/method_delete.go b/resource-manager/netapp/2022-11-01/subvolumes/method_delete.go deleted file mode 100644 index 2f19ed22f0c..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubVolumesClient) Delete(ctx context.Context, id SubVolumeId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c SubVolumesClient) DeleteThenPoll(ctx context.Context, id SubVolumeId) 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/resource-manager/netapp/2022-11-01/subvolumes/method_get.go b/resource-manager/netapp/2022-11-01/subvolumes/method_get.go deleted file mode 100644 index 063628c3271..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package subvolumes - -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 *SubvolumeInfo -} - -// Get ... -func (c SubVolumesClient) Get(ctx context.Context, id SubVolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/method_getmetadata.go b/resource-manager/netapp/2022-11-01/subvolumes/method_getmetadata.go deleted file mode 100644 index a38be9004ef..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/method_getmetadata.go +++ /dev/null @@ -1,70 +0,0 @@ -package subvolumes - -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 GetMetadataOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// GetMetadata ... -func (c SubVolumesClient) GetMetadata(ctx context.Context, id SubVolumeId) (result GetMetadataOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/getMetadata", 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 -} - -// GetMetadataThenPoll performs GetMetadata then polls until it's completed -func (c SubVolumesClient) GetMetadataThenPoll(ctx context.Context, id SubVolumeId) error { - result, err := c.GetMetadata(ctx, id) - if err != nil { - return fmt.Errorf("performing GetMetadata: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after GetMetadata: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/method_listbyvolume.go b/resource-manager/netapp/2022-11-01/subvolumes/method_listbyvolume.go deleted file mode 100644 index 50bba7a698f..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/method_listbyvolume.go +++ /dev/null @@ -1,89 +0,0 @@ -package subvolumes - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]SubvolumeInfo -} - -type ListByVolumeCompleteResult struct { - Items []SubvolumeInfo -} - -// ListByVolume ... -func (c SubVolumesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/subVolumes", 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 *[]SubvolumeInfo `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListByVolumeComplete retrieves all the results into a single object -func (c SubVolumesClient) ListByVolumeComplete(ctx context.Context, id VolumeId) (ListByVolumeCompleteResult, error) { - return c.ListByVolumeCompleteMatchingPredicate(ctx, id, SubvolumeInfoOperationPredicate{}) -} - -// ListByVolumeCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c SubVolumesClient) ListByVolumeCompleteMatchingPredicate(ctx context.Context, id VolumeId, predicate SubvolumeInfoOperationPredicate) (result ListByVolumeCompleteResult, err error) { - items := make([]SubvolumeInfo, 0) - - resp, err := c.ListByVolume(ctx, id) - if err != nil { - 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 = ListByVolumeCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/method_update.go b/resource-manager/netapp/2022-11-01/subvolumes/method_update.go deleted file mode 100644 index 919d2776e7f..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package subvolumes - -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 -} - -// Update ... -func (c SubVolumesClient) Update(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) (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 SubVolumesClient) UpdateThenPoll(ctx context.Context, id SubVolumeId, input SubvolumePatchRequest) 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/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeinfo.go b/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeinfo.go deleted file mode 100644 index 3adbcfc6002..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeinfo.go +++ /dev/null @@ -1,16 +0,0 @@ -package subvolumes - -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 SubvolumeInfo struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodel.go b/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodel.go deleted file mode 100644 index d15828e2987..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodel.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeModel struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties *SubvolumeModelProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodelproperties.go b/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodelproperties.go deleted file mode 100644 index 26911c386fc..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumemodelproperties.go +++ /dev/null @@ -1,71 +0,0 @@ -package subvolumes - -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 SubvolumeModelProperties struct { - AccessedTimeStamp *string `json:"accessedTimeStamp,omitempty"` - BytesUsed *int64 `json:"bytesUsed,omitempty"` - ChangedTimeStamp *string `json:"changedTimeStamp,omitempty"` - CreationTimeStamp *string `json:"creationTimeStamp,omitempty"` - ModifiedTimeStamp *string `json:"modifiedTimeStamp,omitempty"` - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - Permissions *string `json:"permissions,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} - -func (o *SubvolumeModelProperties) GetAccessedTimeStampAsTime() (*time.Time, error) { - if o.AccessedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.AccessedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetAccessedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.AccessedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetChangedTimeStampAsTime() (*time.Time, error) { - if o.ChangedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ChangedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetChangedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ChangedTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetCreationTimeStampAsTime() (*time.Time, error) { - if o.CreationTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.CreationTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetCreationTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.CreationTimeStamp = &formatted -} - -func (o *SubvolumeModelProperties) GetModifiedTimeStampAsTime() (*time.Time, error) { - if o.ModifiedTimeStamp == nil { - return nil, nil - } - return dates.ParseAsFormat(o.ModifiedTimeStamp, "2006-01-02T15:04:05Z07:00") -} - -func (o *SubvolumeModelProperties) SetModifiedTimeStampAsTime(input time.Time) { - formatted := input.Format("2006-01-02T15:04:05Z07:00") - o.ModifiedTimeStamp = &formatted -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchparams.go b/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchparams.go deleted file mode 100644 index 02ea94ff0ac..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchparams.go +++ /dev/null @@ -1,9 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchParams struct { - Path *string `json:"path,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchrequest.go b/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchrequest.go deleted file mode 100644 index 0394a55073a..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumepatchrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumePatchRequest struct { - Properties *SubvolumePatchParams `json:"properties,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeproperties.go b/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeproperties.go deleted file mode 100644 index 899e995183a..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/model_subvolumeproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeProperties struct { - ParentPath *string `json:"parentPath,omitempty"` - Path *string `json:"path,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Size *int64 `json:"size,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/subvolumes/predicates.go b/resource-manager/netapp/2022-11-01/subvolumes/predicates.go deleted file mode 100644 index af649a6bd08..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/predicates.go +++ /dev/null @@ -1,27 +0,0 @@ -package subvolumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type SubvolumeInfoOperationPredicate struct { - Id *string - Name *string - Type *string -} - -func (p SubvolumeInfoOperationPredicate) Matches(input SubvolumeInfo) 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/resource-manager/netapp/2022-11-01/subvolumes/version.go b/resource-manager/netapp/2022-11-01/subvolumes/version.go deleted file mode 100644 index 299d20efbb4..00000000000 --- a/resource-manager/netapp/2022-11-01/subvolumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package subvolumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/subvolumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/README.md b/resource-manager/netapp/2022-11-01/volumegroups/README.md deleted file mode 100644 index 758fea0135d..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/README.md +++ /dev/null @@ -1,81 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumegroups` Documentation - -The `volumegroups` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/volumegroups" -``` - - -### Client Initialization - -```go -client := volumegroups.NewVolumeGroupsClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeGroupsClient.Create` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -payload := volumegroups.VolumeGroupDetails{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Delete` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeGroupsClient.Get` - -```go -ctx := context.TODO() -id := volumegroups.NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - -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: `VolumeGroupsClient.ListByNetAppAccount` - -```go -ctx := context.TODO() -id := volumegroups.NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - -read, err := client.ListByNetAppAccount(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` diff --git a/resource-manager/netapp/2022-11-01/volumegroups/client.go b/resource-manager/netapp/2022-11-01/volumegroups/client.go deleted file mode 100644 index a117e697f04..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient struct { - Client *resourcemanager.Client -} - -func NewVolumeGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeGroupsClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumegroups", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeGroupsClient: %+v", err) - } - - return &VolumeGroupsClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/constants.go b/resource-manager/netapp/2022-11-01/volumegroups/constants.go deleted file mode 100644 index 316053ae00c..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/constants.go +++ /dev/null @@ -1,596 +0,0 @@ -package volumegroups - -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 ApplicationType string - -const ( - ApplicationTypeSAPNegativeHANA ApplicationType = "SAP-HANA" -) - -func PossibleValuesForApplicationType() []string { - return []string{ - string(ApplicationTypeSAPNegativeHANA), - } -} - -func (s *ApplicationType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseApplicationType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseApplicationType(input string) (*ApplicationType, error) { - vals := map[string]ApplicationType{ - "sap-hana": ApplicationTypeSAPNegativeHANA, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ApplicationType(input) - return &out, nil -} - -type AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityAcrossTTwo VolumeStorageToNetworkProximity = "AcrossT2" - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityAcrossTTwo), - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "acrosst2": VolumeStorageToNetworkProximityAcrossTTwo, - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go b/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go deleted file mode 100644 index 180947b711b..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount.go +++ /dev/null @@ -1,125 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - } -} - -// 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/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount_test.go b/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount_test.go deleted file mode 100644 index 42d30d6c431..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/id_netappaccount_test.go +++ /dev/null @@ -1,282 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = NetAppAccountId{} - -func TestNewNetAppAccountID(t *testing.T) { - id := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } -} - -func TestFormatNetAppAccountID(t *testing.T) { - actual := NewNetAppAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseNetAppAccountID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestParseNetAppAccountIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *NetAppAccountId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Expected: &NetAppAccountId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseNetAppAccountIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - } -} - -func TestSegmentsForNetAppAccountId(t *testing.T) { - segments := NetAppAccountId{}.Segments() - if len(segments) == 0 { - t.Fatalf("NetAppAccountId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go b/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go deleted file mode 100644 index f97a6bb10bd..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumegroups - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -// VolumeGroupId is a struct representing the Resource ID for a Volume Group -type VolumeGroupId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - VolumeGroupName string -} - -// NewVolumeGroupID returns a new VolumeGroupId struct -func NewVolumeGroupID(subscriptionId string, resourceGroupName string, netAppAccountName string, volumeGroupName string) VolumeGroupId { - return VolumeGroupId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - VolumeGroupName: volumeGroupName, - } -} - -// ParseVolumeGroupID parses 'input' into a VolumeGroupId -func ParseVolumeGroupID(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeGroupIDInsensitively parses 'input' case-insensitively into a VolumeGroupId -// note: this method should only be used for API response data and not user input -func ParseVolumeGroupIDInsensitively(input string) (*VolumeGroupId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeGroupId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeGroupId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeGroupId) 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.VolumeGroupName, ok = input.Parsed["volumeGroupName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeGroupName", input) - } - - return nil -} - -// ValidateVolumeGroupID checks that 'input' can be parsed as a Volume Group ID -func ValidateVolumeGroupID(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 := ParseVolumeGroupID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Group ID -func (id VolumeGroupId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/volumeGroups/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.VolumeGroupName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Group ID -func (id VolumeGroupId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticVolumeGroups", "volumeGroups", "volumeGroups"), - resourceids.UserSpecifiedSegment("volumeGroupName", "volumeGroupValue"), - } -} - -// String returns a human-readable description of this Volume Group ID -func (id VolumeGroupId) 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("Volume Group Name: %q", id.VolumeGroupName), - } - return fmt.Sprintf("Volume Group (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup_test.go b/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup_test.go deleted file mode 100644 index d8c69411672..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/id_volumegroup_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumegroups - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeGroupId{} - -func TestNewVolumeGroupID(t *testing.T) { - id := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.VolumeGroupName != "volumeGroupValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeGroupName'", id.VolumeGroupName, "volumeGroupValue") - } -} - -func TestFormatVolumeGroupID(t *testing.T) { - actual := NewVolumeGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "volumeGroupValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeGroupID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestParseVolumeGroupIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeGroupId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - VolumeGroupName: "volumeGroupValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/volumeGroups/volumeGroupValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE", - Expected: &VolumeGroupId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - VolumeGroupName: "vOlUmEgRoUpVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/vOlUmEgRoUpS/vOlUmEgRoUpVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeGroupIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.VolumeGroupName != v.Expected.VolumeGroupName { - t.Fatalf("Expected %q but got %q for VolumeGroupName", v.Expected.VolumeGroupName, actual.VolumeGroupName) - } - - } -} - -func TestSegmentsForVolumeGroupId(t *testing.T) { - segments := VolumeGroupId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeGroupId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/method_create.go b/resource-manager/netapp/2022-11-01/volumegroups/method_create.go deleted file mode 100644 index 13500e108f3..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/method_create.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumegroups - -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 -} - -// Create ... -func (c VolumeGroupsClient) Create(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) (result CreateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusCreated, - }, - 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 VolumeGroupsClient) CreateThenPoll(ctx context.Context, id VolumeGroupId, input VolumeGroupDetails) 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/resource-manager/netapp/2022-11-01/volumegroups/method_delete.go b/resource-manager/netapp/2022-11-01/volumegroups/method_delete.go deleted file mode 100644 index 32e6c75b150..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumegroups - -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 VolumeGroupsClient) Delete(ctx context.Context, id VolumeGroupId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeGroupsClient) DeleteThenPoll(ctx context.Context, id VolumeGroupId) 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/resource-manager/netapp/2022-11-01/volumegroups/method_get.go b/resource-manager/netapp/2022-11-01/volumegroups/method_get.go deleted file mode 100644 index 6a14cec40c4..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumegroups - -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 *VolumeGroupDetails -} - -// Get ... -func (c VolumeGroupsClient) Get(ctx context.Context, id VolumeGroupId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/method_listbynetappaccount.go b/resource-manager/netapp/2022-11-01/volumegroups/method_listbynetappaccount.go deleted file mode 100644 index 0a84dcdd8e0..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/method_listbynetappaccount.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumegroups - -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 *VolumeGroupList -} - -// ListByNetAppAccount ... -func (c VolumeGroupsClient) 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, - Path: fmt.Sprintf("%s/volumeGroups", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_exportpolicyrule.go b/resource-manager/netapp/2022-11-01/volumegroups/model_exportpolicyrule.go deleted file mode 100644 index e17395ba1a7..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -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 ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_mounttargetproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_mounttargetproperties.go deleted file mode 100644 index 5844b80ce9d..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -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 MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-11-01/volumegroups/model_placementkeyvaluepairs.go deleted file mode 100644 index 1714b1662a1..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -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 PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_replicationobject.go b/resource-manager/netapp/2022-11-01/volumegroups/model_replicationobject.go deleted file mode 100644 index 6d145aa0079..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -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 ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumebackupproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumebackupproperties.go deleted file mode 100644 index 20e1850964e..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumebackupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -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 { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroup.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroup.go deleted file mode 100644 index 5e4df7bb9c0..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroup.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroup struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupListProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupdetails.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupdetails.go deleted file mode 100644 index 5f01af82c0f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupdetails.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupDetails struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumeGroupProperties `json:"properties,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplist.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplist.go deleted file mode 100644 index 447c6e6e858..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplist.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeGroupList struct { - Value *[]VolumeGroup `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplistproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplistproperties.go deleted file mode 100644 index 5788ee516fc..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegrouplistproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeGroupListProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupmetadata.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupmetadata.go deleted file mode 100644 index 30441c6826d..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupmetadata.go +++ /dev/null @@ -1,13 +0,0 @@ -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 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/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupproperties.go deleted file mode 100644 index 0bab153b397..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -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 VolumeGroupProperties struct { - GroupMetaData *VolumeGroupMetaData `json:"groupMetaData,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - Volumes *[]VolumeGroupVolumeProperties `json:"volumes,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupvolumeproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupvolumeproperties.go deleted file mode 100644 index 61bbdab9ce3..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumegroupvolumeproperties.go +++ /dev/null @@ -1,12 +0,0 @@ -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 VolumeGroupVolumeProperties struct { - Id *string `json:"id,omitempty"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumeproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumeproperties.go deleted file mode 100644 index 7e5abcc724f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumeproperties.go +++ /dev/null @@ -1,60 +0,0 @@ -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 VolumeProperties struct { - ActualThroughputMibps *float64 `json:"actualThroughputMibps,omitempty"` - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - OriginatingResourceId *string `json:"originatingResourceId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesdataprotection.go deleted file mode 100644 index 632e45e64b0..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -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 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/resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesexportpolicy.go deleted file mode 100644 index 227c8586d6f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumerelocationproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumerelocationproperties.go deleted file mode 100644 index 4fea57c7396..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-11-01/volumegroups/model_volumesnapshotproperties.go deleted file mode 100644 index a3f5011da3b..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -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 VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumegroups/version.go b/resource-manager/netapp/2022-11-01/volumegroups/version.go deleted file mode 100644 index 257ec25018a..00000000000 --- a/resource-manager/netapp/2022-11-01/volumegroups/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumegroups - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumegroups/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/README.md b/resource-manager/netapp/2022-11-01/volumequotarules/README.md deleted file mode 100644 index b586e4e7d71..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/README.md +++ /dev/null @@ -1,98 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumequotarules` Documentation - -The `volumequotarules` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/volumequotarules" -``` - - -### Client Initialization - -```go -client := volumequotarules.NewVolumeQuotaRulesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumeQuotaRulesClient.Create` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRule{ - // ... -} - - -if err := client.CreateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Delete` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -if err := client.DeleteThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Get` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -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: `VolumeQuotaRulesClient.ListByVolume` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.ListByVolume(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumeQuotaRulesClient.Update` - -```go -ctx := context.TODO() -id := volumequotarules.NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - -payload := volumequotarules.VolumeQuotaRulePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/client.go b/resource-manager/netapp/2022-11-01/volumequotarules/client.go deleted file mode 100644 index c6c70e112e0..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient struct { - Client *resourcemanager.Client -} - -func NewVolumeQuotaRulesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumeQuotaRulesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumequotarules", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumeQuotaRulesClient: %+v", err) - } - - return &VolumeQuotaRulesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/constants.go b/resource-manager/netapp/2022-11-01/volumequotarules/constants.go deleted file mode 100644 index fb0e41e1afb..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/constants.go +++ /dev/null @@ -1,113 +0,0 @@ -package volumequotarules - -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 ProvisioningState string - -const ( - ProvisioningStateAccepted ProvisioningState = "Accepted" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" - ProvisioningStateMoving ProvisioningState = "Moving" - ProvisioningStatePatching ProvisioningState = "Patching" - ProvisioningStateSucceeded ProvisioningState = "Succeeded" -) - -func PossibleValuesForProvisioningState() []string { - return []string{ - string(ProvisioningStateAccepted), - string(ProvisioningStateCreating), - string(ProvisioningStateDeleting), - string(ProvisioningStateFailed), - string(ProvisioningStateMoving), - string(ProvisioningStatePatching), - string(ProvisioningStateSucceeded), - } -} - -func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseProvisioningState(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseProvisioningState(input string) (*ProvisioningState, error) { - vals := map[string]ProvisioningState{ - "accepted": ProvisioningStateAccepted, - "creating": ProvisioningStateCreating, - "deleting": ProvisioningStateDeleting, - "failed": ProvisioningStateFailed, - "moving": ProvisioningStateMoving, - "patching": ProvisioningStatePatching, - "succeeded": ProvisioningStateSucceeded, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ProvisioningState(input) - return &out, nil -} - -type Type string - -const ( - TypeDefaultGroupQuota Type = "DefaultGroupQuota" - TypeDefaultUserQuota Type = "DefaultUserQuota" - TypeIndividualGroupQuota Type = "IndividualGroupQuota" - TypeIndividualUserQuota Type = "IndividualUserQuota" -) - -func PossibleValuesForType() []string { - return []string{ - string(TypeDefaultGroupQuota), - string(TypeDefaultUserQuota), - string(TypeIndividualGroupQuota), - string(TypeIndividualUserQuota), - } -} - -func (s *Type) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseType(input string) (*Type, error) { - vals := map[string]Type{ - "defaultgroupquota": TypeDefaultGroupQuota, - "defaultuserquota": TypeDefaultUserQuota, - "individualgroupquota": TypeIndividualGroupQuota, - "individualuserquota": TypeIndividualUserQuota, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := Type(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go b/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go deleted file mode 100644 index b3d6ab761b3..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/volumequotarules/id_volume_test.go b/resource-manager/netapp/2022-11-01/volumequotarules/id_volume_test.go deleted file mode 100644 index 98a3bd4ff39..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go b/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go deleted file mode 100644 index 711a80ae5cd..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule.go +++ /dev/null @@ -1,152 +0,0 @@ -package volumequotarules - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -// VolumeQuotaRuleId is a struct representing the Resource ID for a Volume Quota Rule -type VolumeQuotaRuleId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string - VolumeName string - VolumeQuotaRuleName string -} - -// NewVolumeQuotaRuleID returns a new VolumeQuotaRuleId struct -func NewVolumeQuotaRuleID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string, volumeName string, volumeQuotaRuleName string) VolumeQuotaRuleId { - return VolumeQuotaRuleId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - VolumeName: volumeName, - VolumeQuotaRuleName: volumeQuotaRuleName, - } -} - -// ParseVolumeQuotaRuleID parses 'input' into a VolumeQuotaRuleId -func ParseVolumeQuotaRuleID(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseVolumeQuotaRuleIDInsensitively parses 'input' case-insensitively into a VolumeQuotaRuleId -// note: this method should only be used for API response data and not user input -func ParseVolumeQuotaRuleIDInsensitively(input string) (*VolumeQuotaRuleId, error) { - parser := resourceids.NewParserFromResourceIdType(VolumeQuotaRuleId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := VolumeQuotaRuleId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *VolumeQuotaRuleId) 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) - } - - if id.VolumeQuotaRuleName, ok = input.Parsed["volumeQuotaRuleName"]; !ok { - return resourceids.NewSegmentNotSpecifiedError(id, "volumeQuotaRuleName", input) - } - - return nil -} - -// ValidateVolumeQuotaRuleID checks that 'input' can be parsed as a Volume Quota Rule ID -func ValidateVolumeQuotaRuleID(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 := ParseVolumeQuotaRuleID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Volume Quota Rule ID -func (id VolumeQuotaRuleId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s/volumes/%s/volumeQuotaRules/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName, id.VolumeName, id.VolumeQuotaRuleName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - resourceids.StaticSegment("staticVolumeQuotaRules", "volumeQuotaRules", "volumeQuotaRules"), - resourceids.UserSpecifiedSegment("volumeQuotaRuleName", "volumeQuotaRuleValue"), - } -} - -// String returns a human-readable description of this Volume Quota Rule ID -func (id VolumeQuotaRuleId) 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), - fmt.Sprintf("Volume Quota Rule Name: %q", id.VolumeQuotaRuleName), - } - return fmt.Sprintf("Volume Quota Rule (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule_test.go b/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule_test.go deleted file mode 100644 index a6f3c9d15ab..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/id_volumequotarule_test.go +++ /dev/null @@ -1,417 +0,0 @@ -package volumequotarules - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeQuotaRuleId{} - -func TestNewVolumeQuotaRuleID(t *testing.T) { - id := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } - - if id.VolumeQuotaRuleName != "volumeQuotaRuleValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeQuotaRuleName'", id.VolumeQuotaRuleName, "volumeQuotaRuleValue") - } -} - -func TestFormatVolumeQuotaRuleID(t *testing.T) { - actual := NewVolumeQuotaRuleID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue", "volumeQuotaRuleValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeQuotaRuleID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestParseVolumeQuotaRuleIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeQuotaRuleId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - VolumeQuotaRuleName: "volumeQuotaRuleValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/volumeQuotaRules/volumeQuotaRuleValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE", - Expected: &VolumeQuotaRuleId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - VolumeQuotaRuleName: "vOlUmEqUoTaRuLeVaLuE", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/vOlUmEqUoTaRuLeS/vOlUmEqUoTaRuLeVaLuE/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeQuotaRuleIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - if actual.VolumeQuotaRuleName != v.Expected.VolumeQuotaRuleName { - t.Fatalf("Expected %q but got %q for VolumeQuotaRuleName", v.Expected.VolumeQuotaRuleName, actual.VolumeQuotaRuleName) - } - - } -} - -func TestSegmentsForVolumeQuotaRuleId(t *testing.T) { - segments := VolumeQuotaRuleId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeQuotaRuleId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/method_create.go b/resource-manager/netapp/2022-11-01/volumequotarules/method_create.go deleted file mode 100644 index f052dfadc2f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/method_create.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Create ... -func (c VolumeQuotaRulesClient) Create(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) (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 VolumeQuotaRulesClient) CreateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRule) 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/resource-manager/netapp/2022-11-01/volumequotarules/method_delete.go b/resource-manager/netapp/2022-11-01/volumequotarules/method_delete.go deleted file mode 100644 index 59d6fbecf0a..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/method_delete.go +++ /dev/null @@ -1,71 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRulesClient) Delete(ctx context.Context, id VolumeQuotaRuleId) (result DeleteOperationResponse, 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 -} - -// DeleteThenPoll performs Delete then polls until it's completed -func (c VolumeQuotaRulesClient) DeleteThenPoll(ctx context.Context, id VolumeQuotaRuleId) 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/resource-manager/netapp/2022-11-01/volumequotarules/method_get.go b/resource-manager/netapp/2022-11-01/volumequotarules/method_get.go deleted file mode 100644 index bed8822bc79..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumequotarules - -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 *VolumeQuotaRule -} - -// Get ... -func (c VolumeQuotaRulesClient) Get(ctx context.Context, id VolumeQuotaRuleId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/method_listbyvolume.go b/resource-manager/netapp/2022-11-01/volumequotarules/method_listbyvolume.go deleted file mode 100644 index 1bdc8b8007c..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/method_listbyvolume.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumequotarules - -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 ListByVolumeOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *VolumeQuotaRulesList -} - -// ListByVolume ... -func (c VolumeQuotaRulesClient) ListByVolume(ctx context.Context, id VolumeId) (result ListByVolumeOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumeQuotaRules", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/method_update.go b/resource-manager/netapp/2022-11-01/volumequotarules/method_update.go deleted file mode 100644 index 2201827bac1..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumequotarules - -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 -} - -// Update ... -func (c VolumeQuotaRulesClient) Update(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) (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 VolumeQuotaRulesClient) UpdateThenPoll(ctx context.Context, id VolumeQuotaRuleId, input VolumeQuotaRulePatch) 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/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarule.go b/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarule.go deleted file mode 100644 index 9436f5c0008..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarule.go +++ /dev/null @@ -1,18 +0,0 @@ -package volumequotarules - -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 VolumeQuotaRule struct { - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulepatch.go b/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulepatch.go deleted file mode 100644 index fbf72546c43..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulepatch.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulePatch struct { - Properties *VolumeQuotaRulesProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotaruleslist.go b/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotaruleslist.go deleted file mode 100644 index d9e15cf8035..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotaruleslist.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesList struct { - Value *[]VolumeQuotaRule `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulesproperties.go b/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulesproperties.go deleted file mode 100644 index 5ae037e0a23..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/model_volumequotarulesproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumequotarules - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeQuotaRulesProperties struct { - ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` - QuotaSizeInKiBs *int64 `json:"quotaSizeInKiBs,omitempty"` - QuotaTarget *string `json:"quotaTarget,omitempty"` - QuotaType *Type `json:"quotaType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumequotarules/version.go b/resource-manager/netapp/2022-11-01/volumequotarules/version.go deleted file mode 100644 index 9eaea6a3912..00000000000 --- a/resource-manager/netapp/2022-11-01/volumequotarules/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumequotarules - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumequotarules/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/volumes/README.md b/resource-manager/netapp/2022-11-01/volumes/README.md deleted file mode 100644 index 64b2c65d7bb..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/README.md +++ /dev/null @@ -1,99 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumes` Documentation - -The `volumes` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/volumes" -``` - - -### Client Initialization - -```go -client := volumes.NewVolumesClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesClient.CreateOrUpdate` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.Volume{ - // ... -} - - -if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Delete` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.DeleteThenPoll(ctx, id, volumes.DefaultDeleteOperationOptions()); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesClient.Get` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.Get(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesClient.List` - -```go -ctx := context.TODO() -id := volumes.NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - -// alternatively `client.List(ctx, id)` can be used to do batched pagination -items, err := client.ListComplete(ctx, id) -if err != nil { - // handle the error -} -for _, item := range items { - // do something -} -``` - - -### Example Usage: `VolumesClient.Update` - -```go -ctx := context.TODO() -id := volumes.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumes.VolumePatch{ - // ... -} - - -if err := client.UpdateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/volumes/client.go b/resource-manager/netapp/2022-11-01/volumes/client.go deleted file mode 100644 index 9f34fb4a6eb..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumes - -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 VolumesClient struct { - Client *resourcemanager.Client -} - -func NewVolumesClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumes", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesClient: %+v", err) - } - - return &VolumesClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumes/constants.go b/resource-manager/netapp/2022-11-01/volumes/constants.go deleted file mode 100644 index 0401d41754c..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/constants.go +++ /dev/null @@ -1,558 +0,0 @@ -package volumes - -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 AvsDataStore string - -const ( - AvsDataStoreDisabled AvsDataStore = "Disabled" - AvsDataStoreEnabled AvsDataStore = "Enabled" -) - -func PossibleValuesForAvsDataStore() []string { - return []string{ - string(AvsDataStoreDisabled), - string(AvsDataStoreEnabled), - } -} - -func (s *AvsDataStore) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseAvsDataStore(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseAvsDataStore(input string) (*AvsDataStore, error) { - vals := map[string]AvsDataStore{ - "disabled": AvsDataStoreDisabled, - "enabled": AvsDataStoreEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := AvsDataStore(input) - return &out, nil -} - -type ChownMode string - -const ( - ChownModeRestricted ChownMode = "Restricted" - ChownModeUnrestricted ChownMode = "Unrestricted" -) - -func PossibleValuesForChownMode() []string { - return []string{ - string(ChownModeRestricted), - string(ChownModeUnrestricted), - } -} - -func (s *ChownMode) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseChownMode(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseChownMode(input string) (*ChownMode, error) { - vals := map[string]ChownMode{ - "restricted": ChownModeRestricted, - "unrestricted": ChownModeUnrestricted, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ChownMode(input) - return &out, nil -} - -type EnableSubvolumes string - -const ( - EnableSubvolumesDisabled EnableSubvolumes = "Disabled" - EnableSubvolumesEnabled EnableSubvolumes = "Enabled" -) - -func PossibleValuesForEnableSubvolumes() []string { - return []string{ - string(EnableSubvolumesDisabled), - string(EnableSubvolumesEnabled), - } -} - -func (s *EnableSubvolumes) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEnableSubvolumes(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEnableSubvolumes(input string) (*EnableSubvolumes, error) { - vals := map[string]EnableSubvolumes{ - "disabled": EnableSubvolumesDisabled, - "enabled": EnableSubvolumesEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EnableSubvolumes(input) - return &out, nil -} - -type EncryptionKeySource string - -const ( - EncryptionKeySourceMicrosoftPointKeyVault EncryptionKeySource = "Microsoft.KeyVault" - EncryptionKeySourceMicrosoftPointNetApp EncryptionKeySource = "Microsoft.NetApp" -) - -func PossibleValuesForEncryptionKeySource() []string { - return []string{ - string(EncryptionKeySourceMicrosoftPointKeyVault), - string(EncryptionKeySourceMicrosoftPointNetApp), - } -} - -func (s *EncryptionKeySource) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEncryptionKeySource(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEncryptionKeySource(input string) (*EncryptionKeySource, error) { - vals := map[string]EncryptionKeySource{ - "microsoft.keyvault": EncryptionKeySourceMicrosoftPointKeyVault, - "microsoft.netapp": EncryptionKeySourceMicrosoftPointNetApp, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EncryptionKeySource(input) - return &out, nil -} - -type EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type FileAccessLogs string - -const ( - FileAccessLogsDisabled FileAccessLogs = "Disabled" - FileAccessLogsEnabled FileAccessLogs = "Enabled" -) - -func PossibleValuesForFileAccessLogs() []string { - return []string{ - string(FileAccessLogsDisabled), - string(FileAccessLogsEnabled), - } -} - -func (s *FileAccessLogs) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseFileAccessLogs(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseFileAccessLogs(input string) (*FileAccessLogs, error) { - vals := map[string]FileAccessLogs{ - "disabled": FileAccessLogsDisabled, - "enabled": FileAccessLogsEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := FileAccessLogs(input) - return &out, nil -} - -type NetworkFeatures string - -const ( - NetworkFeaturesBasic NetworkFeatures = "Basic" - NetworkFeaturesStandard NetworkFeatures = "Standard" -) - -func PossibleValuesForNetworkFeatures() []string { - return []string{ - string(NetworkFeaturesBasic), - string(NetworkFeaturesStandard), - } -} - -func (s *NetworkFeatures) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseNetworkFeatures(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseNetworkFeatures(input string) (*NetworkFeatures, error) { - vals := map[string]NetworkFeatures{ - "basic": NetworkFeaturesBasic, - "standard": NetworkFeaturesStandard, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := NetworkFeatures(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} - -type SecurityStyle string - -const ( - SecurityStyleNtfs SecurityStyle = "ntfs" - SecurityStyleUnix SecurityStyle = "unix" -) - -func PossibleValuesForSecurityStyle() []string { - return []string{ - string(SecurityStyleNtfs), - string(SecurityStyleUnix), - } -} - -func (s *SecurityStyle) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSecurityStyle(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSecurityStyle(input string) (*SecurityStyle, error) { - vals := map[string]SecurityStyle{ - "ntfs": SecurityStyleNtfs, - "unix": SecurityStyleUnix, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SecurityStyle(input) - return &out, nil -} - -type ServiceLevel string - -const ( - ServiceLevelPremium ServiceLevel = "Premium" - ServiceLevelStandard ServiceLevel = "Standard" - ServiceLevelStandardZRS ServiceLevel = "StandardZRS" - ServiceLevelUltra ServiceLevel = "Ultra" -) - -func PossibleValuesForServiceLevel() []string { - return []string{ - string(ServiceLevelPremium), - string(ServiceLevelStandard), - string(ServiceLevelStandardZRS), - string(ServiceLevelUltra), - } -} - -func (s *ServiceLevel) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseServiceLevel(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseServiceLevel(input string) (*ServiceLevel, error) { - vals := map[string]ServiceLevel{ - "premium": ServiceLevelPremium, - "standard": ServiceLevelStandard, - "standardzrs": ServiceLevelStandardZRS, - "ultra": ServiceLevelUltra, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ServiceLevel(input) - return &out, nil -} - -type SmbAccessBasedEnumeration string - -const ( - SmbAccessBasedEnumerationDisabled SmbAccessBasedEnumeration = "Disabled" - SmbAccessBasedEnumerationEnabled SmbAccessBasedEnumeration = "Enabled" -) - -func PossibleValuesForSmbAccessBasedEnumeration() []string { - return []string{ - string(SmbAccessBasedEnumerationDisabled), - string(SmbAccessBasedEnumerationEnabled), - } -} - -func (s *SmbAccessBasedEnumeration) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbAccessBasedEnumeration(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbAccessBasedEnumeration(input string) (*SmbAccessBasedEnumeration, error) { - vals := map[string]SmbAccessBasedEnumeration{ - "disabled": SmbAccessBasedEnumerationDisabled, - "enabled": SmbAccessBasedEnumerationEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbAccessBasedEnumeration(input) - return &out, nil -} - -type SmbNonBrowsable string - -const ( - SmbNonBrowsableDisabled SmbNonBrowsable = "Disabled" - SmbNonBrowsableEnabled SmbNonBrowsable = "Enabled" -) - -func PossibleValuesForSmbNonBrowsable() []string { - return []string{ - string(SmbNonBrowsableDisabled), - string(SmbNonBrowsableEnabled), - } -} - -func (s *SmbNonBrowsable) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseSmbNonBrowsable(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseSmbNonBrowsable(input string) (*SmbNonBrowsable, error) { - vals := map[string]SmbNonBrowsable{ - "disabled": SmbNonBrowsableDisabled, - "enabled": SmbNonBrowsableEnabled, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := SmbNonBrowsable(input) - return &out, nil -} - -type VolumeStorageToNetworkProximity string - -const ( - VolumeStorageToNetworkProximityAcrossTTwo VolumeStorageToNetworkProximity = "AcrossT2" - VolumeStorageToNetworkProximityDefault VolumeStorageToNetworkProximity = "Default" - VolumeStorageToNetworkProximityTOne VolumeStorageToNetworkProximity = "T1" - VolumeStorageToNetworkProximityTTwo VolumeStorageToNetworkProximity = "T2" -) - -func PossibleValuesForVolumeStorageToNetworkProximity() []string { - return []string{ - string(VolumeStorageToNetworkProximityAcrossTTwo), - string(VolumeStorageToNetworkProximityDefault), - string(VolumeStorageToNetworkProximityTOne), - string(VolumeStorageToNetworkProximityTTwo), - } -} - -func (s *VolumeStorageToNetworkProximity) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseVolumeStorageToNetworkProximity(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseVolumeStorageToNetworkProximity(input string) (*VolumeStorageToNetworkProximity, error) { - vals := map[string]VolumeStorageToNetworkProximity{ - "acrosst2": VolumeStorageToNetworkProximityAcrossTTwo, - "default": VolumeStorageToNetworkProximityDefault, - "t1": VolumeStorageToNetworkProximityTOne, - "t2": VolumeStorageToNetworkProximityTTwo, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := VolumeStorageToNetworkProximity(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go b/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go deleted file mode 100644 index 9ce092f4fe4..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/id_capacitypool.go +++ /dev/null @@ -1,134 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -// CapacityPoolId is a struct representing the Resource ID for a Capacity Pool -type CapacityPoolId struct { - SubscriptionId string - ResourceGroupName string - NetAppAccountName string - CapacityPoolName string -} - -// NewCapacityPoolID returns a new CapacityPoolId struct -func NewCapacityPoolID(subscriptionId string, resourceGroupName string, netAppAccountName string, capacityPoolName string) CapacityPoolId { - return CapacityPoolId{ - SubscriptionId: subscriptionId, - ResourceGroupName: resourceGroupName, - NetAppAccountName: netAppAccountName, - CapacityPoolName: capacityPoolName, - } -} - -// ParseCapacityPoolID parses 'input' into a CapacityPoolId -func ParseCapacityPoolID(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, false) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -// ParseCapacityPoolIDInsensitively parses 'input' case-insensitively into a CapacityPoolId -// note: this method should only be used for API response data and not user input -func ParseCapacityPoolIDInsensitively(input string) (*CapacityPoolId, error) { - parser := resourceids.NewParserFromResourceIdType(CapacityPoolId{}) - parsed, err := parser.Parse(input, true) - if err != nil { - return nil, fmt.Errorf("parsing %q: %+v", input, err) - } - - id := CapacityPoolId{} - if err := id.FromParseResult(*parsed); err != nil { - return nil, err - } - - return &id, nil -} - -func (id *CapacityPoolId) 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) - } - - return nil -} - -// ValidateCapacityPoolID checks that 'input' can be parsed as a Capacity Pool ID -func ValidateCapacityPoolID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := ParseCapacityPoolID(v); err != nil { - errors = append(errors, err) - } - - return -} - -// ID returns the formatted Capacity Pool ID -func (id CapacityPoolId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.NetApp/netAppAccounts/%s/capacityPools/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.NetAppAccountName, id.CapacityPoolName) -} - -// Segments returns a slice of Resource ID Segments which comprise this Capacity Pool ID -func (id CapacityPoolId) Segments() []resourceids.Segment { - return []resourceids.Segment{ - resourceids.StaticSegment("staticSubscriptions", "subscriptions", "subscriptions"), - resourceids.SubscriptionIdSegment("subscriptionId", "12345678-1234-9876-4563-123456789012"), - resourceids.StaticSegment("staticResourceGroups", "resourceGroups", "resourceGroups"), - resourceids.ResourceGroupSegment("resourceGroupName", "example-resource-group"), - resourceids.StaticSegment("staticProviders", "providers", "providers"), - resourceids.ResourceProviderSegment("staticMicrosoftNetApp", "Microsoft.NetApp", "Microsoft.NetApp"), - resourceids.StaticSegment("staticNetAppAccounts", "netAppAccounts", "netAppAccounts"), - resourceids.UserSpecifiedSegment("netAppAccountName", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - } -} - -// String returns a human-readable description of this Capacity Pool ID -func (id CapacityPoolId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("Net App Account Name: %q", id.NetAppAccountName), - fmt.Sprintf("Capacity Pool Name: %q", id.CapacityPoolName), - } - return fmt.Sprintf("Capacity Pool (%s)", strings.Join(components, "\n")) -} diff --git a/resource-manager/netapp/2022-11-01/volumes/id_capacitypool_test.go b/resource-manager/netapp/2022-11-01/volumes/id_capacitypool_test.go deleted file mode 100644 index 055d673d4be..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/id_capacitypool_test.go +++ /dev/null @@ -1,327 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = CapacityPoolId{} - -func TestNewCapacityPoolID(t *testing.T) { - id := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } -} - -func TestFormatCapacityPoolID(t *testing.T) { - actual := NewCapacityPoolID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseCapacityPoolID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestParseCapacityPoolIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CapacityPoolId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Expected: &CapacityPoolId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseCapacityPoolIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - } -} - -func TestSegmentsForCapacityPoolId(t *testing.T) { - segments := CapacityPoolId{}.Segments() - if len(segments) == 0 { - t.Fatalf("CapacityPoolId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumes/id_volume.go b/resource-manager/netapp/2022-11-01/volumes/id_volume.go deleted file mode 100644 index 0b27e4a330c..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumes - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/volumes/id_volume_test.go b/resource-manager/netapp/2022-11-01/volumes/id_volume_test.go deleted file mode 100644 index 6c6b2858724..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumes - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumes/method_createorupdate.go b/resource-manager/netapp/2022-11-01/volumes/method_createorupdate.go deleted file mode 100644 index 87a3cdb945a..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/method_createorupdate.go +++ /dev/null @@ -1,75 +0,0 @@ -package volumes - -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 -} - -// CreateOrUpdate ... -func (c VolumesClient) CreateOrUpdate(ctx context.Context, id VolumeId, input Volume) (result CreateOrUpdateOperationResponse, 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 -} - -// CreateOrUpdateThenPoll performs CreateOrUpdate then polls until it's completed -func (c VolumesClient) CreateOrUpdateThenPoll(ctx context.Context, id VolumeId, input Volume) error { - result, err := c.CreateOrUpdate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing CreateOrUpdate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after CreateOrUpdate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumes/method_delete.go b/resource-manager/netapp/2022-11-01/volumes/method_delete.go deleted file mode 100644 index 23734d43ae5..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/method_delete.go +++ /dev/null @@ -1,98 +0,0 @@ -package volumes - -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 -} - -type DeleteOperationOptions struct { - ForceDelete *bool -} - -func DefaultDeleteOperationOptions() DeleteOperationOptions { - return DeleteOperationOptions{} -} - -func (o DeleteOperationOptions) ToHeaders() *client.Headers { - out := client.Headers{} - - return &out -} - -func (o DeleteOperationOptions) ToOData() *odata.Query { - out := odata.Query{} - return &out -} - -func (o DeleteOperationOptions) ToQuery() *client.QueryParams { - out := client.QueryParams{} - if o.ForceDelete != nil { - out.Append("forceDelete", fmt.Sprintf("%v", *o.ForceDelete)) - } - return &out -} - -// Delete ... -func (c VolumesClient) Delete(ctx context.Context, id VolumeId, options DeleteOperationOptions) (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(), - OptionsObject: options, - } - - 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 VolumesClient) DeleteThenPoll(ctx context.Context, id VolumeId, options DeleteOperationOptions) error { - result, err := c.Delete(ctx, id, options) - if err != nil { - return fmt.Errorf("performing Delete: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Delete: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumes/method_get.go b/resource-manager/netapp/2022-11-01/volumes/method_get.go deleted file mode 100644 index f7865a3e320..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/method_get.go +++ /dev/null @@ -1,51 +0,0 @@ -package volumes - -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 *Volume -} - -// Get ... -func (c VolumesClient) Get(ctx context.Context, id VolumeId) (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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumes/method_list.go b/resource-manager/netapp/2022-11-01/volumes/method_list.go deleted file mode 100644 index aeea477a83f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/method_list.go +++ /dev/null @@ -1,89 +0,0 @@ -package volumes - -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 ListOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *[]Volume -} - -type ListCompleteResult struct { - Items []Volume -} - -// List ... -func (c VolumesClient) List(ctx context.Context, id CapacityPoolId) (result ListOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/volumes", 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 *[]Volume `json:"value"` - } - if err = resp.Unmarshal(&values); err != nil { - return - } - - result.Model = values.Values - - return -} - -// ListComplete retrieves all the results into a single object -func (c VolumesClient) ListComplete(ctx context.Context, id CapacityPoolId) (ListCompleteResult, error) { - return c.ListCompleteMatchingPredicate(ctx, id, VolumeOperationPredicate{}) -} - -// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate -func (c VolumesClient) ListCompleteMatchingPredicate(ctx context.Context, id CapacityPoolId, predicate VolumeOperationPredicate) (result ListCompleteResult, err error) { - items := make([]Volume, 0) - - resp, err := c.List(ctx, id) - if err != nil { - 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 = ListCompleteResult{ - Items: items, - } - return -} diff --git a/resource-manager/netapp/2022-11-01/volumes/method_update.go b/resource-manager/netapp/2022-11-01/volumes/method_update.go deleted file mode 100644 index 57573abc0e0..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/method_update.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumes - -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 -} - -// Update ... -func (c VolumesClient) Update(ctx context.Context, id VolumeId, input VolumePatch) (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 VolumesClient) UpdateThenPoll(ctx context.Context, id VolumeId, input VolumePatch) error { - result, err := c.Update(ctx, id, input) - if err != nil { - return fmt.Errorf("performing Update: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after Update: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_exportpolicyrule.go b/resource-manager/netapp/2022-11-01/volumes/model_exportpolicyrule.go deleted file mode 100644 index 9b059c74757..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_exportpolicyrule.go +++ /dev/null @@ -1,22 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ExportPolicyRule struct { - AllowedClients *string `json:"allowedClients,omitempty"` - ChownMode *ChownMode `json:"chownMode,omitempty"` - Cifs *bool `json:"cifs,omitempty"` - HasRootAccess *bool `json:"hasRootAccess,omitempty"` - Kerberos5ReadOnly *bool `json:"kerberos5ReadOnly,omitempty"` - Kerberos5ReadWrite *bool `json:"kerberos5ReadWrite,omitempty"` - Kerberos5iReadOnly *bool `json:"kerberos5iReadOnly,omitempty"` - Kerberos5iReadWrite *bool `json:"kerberos5iReadWrite,omitempty"` - Kerberos5pReadOnly *bool `json:"kerberos5pReadOnly,omitempty"` - Kerberos5pReadWrite *bool `json:"kerberos5pReadWrite,omitempty"` - Nfsv3 *bool `json:"nfsv3,omitempty"` - Nfsv41 *bool `json:"nfsv41,omitempty"` - RuleIndex *int64 `json:"ruleIndex,omitempty"` - UnixReadOnly *bool `json:"unixReadOnly,omitempty"` - UnixReadWrite *bool `json:"unixReadWrite,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_mounttargetproperties.go b/resource-manager/netapp/2022-11-01/volumes/model_mounttargetproperties.go deleted file mode 100644 index 7f5c238183c..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_mounttargetproperties.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type MountTargetProperties struct { - FileSystemId string `json:"fileSystemId"` - IPAddress *string `json:"ipAddress,omitempty"` - MountTargetId *string `json:"mountTargetId,omitempty"` - SmbServerFqdn *string `json:"smbServerFqdn,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_placementkeyvaluepairs.go b/resource-manager/netapp/2022-11-01/volumes/model_placementkeyvaluepairs.go deleted file mode 100644 index 588e9729c1e..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_placementkeyvaluepairs.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type PlacementKeyValuePairs struct { - Key string `json:"key"` - Value string `json:"value"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_replicationobject.go b/resource-manager/netapp/2022-11-01/volumes/model_replicationobject.go deleted file mode 100644 index b7d6873811e..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_replicationobject.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationObject struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationId *string `json:"replicationId,omitempty"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volume.go b/resource-manager/netapp/2022-11-01/volumes/model_volume.go deleted file mode 100644 index 1679818444b..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volume.go +++ /dev/null @@ -1,21 +0,0 @@ -package volumes - -import ( - "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" - "github.com/hashicorp/go-azure-helpers/resourcemanager/zones" -) - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Volume struct { - Etag *string `json:"etag,omitempty"` - Id *string `json:"id,omitempty"` - Location string `json:"location"` - Name *string `json:"name,omitempty"` - Properties VolumeProperties `json:"properties"` - SystemData *systemdata.SystemData `json:"systemData,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` - Zones *zones.Schema `json:"zones,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumebackupproperties.go b/resource-manager/netapp/2022-11-01/volumes/model_volumebackupproperties.go deleted file mode 100644 index 73d11e763f1..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumebackupproperties.go +++ /dev/null @@ -1,10 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeBackupProperties struct { - BackupEnabled *bool `json:"backupEnabled,omitempty"` - BackupPolicyId *string `json:"backupPolicyId,omitempty"` - PolicyEnforced *bool `json:"policyEnforced,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumepatch.go b/resource-manager/netapp/2022-11-01/volumes/model_volumepatch.go deleted file mode 100644 index b39ea01aee8..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumepatch.go +++ /dev/null @@ -1,13 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatch struct { - Id *string `json:"id,omitempty"` - Location *string `json:"location,omitempty"` - Name *string `json:"name,omitempty"` - Properties *VolumePatchProperties `json:"properties,omitempty"` - Tags *map[string]string `json:"tags,omitempty"` - Type *string `json:"type,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumepatchproperties.go b/resource-manager/netapp/2022-11-01/volumes/model_volumepatchproperties.go deleted file mode 100644 index 52172355ea1..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumepatchproperties.go +++ /dev/null @@ -1,19 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchProperties struct { - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - DataProtection *VolumePatchPropertiesDataProtection `json:"dataProtection,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - ExportPolicy *VolumePatchPropertiesExportPolicy `json:"exportPolicy,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold *int64 `json:"usageThreshold,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesdataprotection.go b/resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesdataprotection.go deleted file mode 100644 index 8c9edc10ff7..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesdataprotection.go +++ /dev/null @@ -1,9 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesexportpolicy.go deleted file mode 100644 index ae83a5fc1b4..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumepatchpropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePatchPropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumeproperties.go b/resource-manager/netapp/2022-11-01/volumes/model_volumeproperties.go deleted file mode 100644 index 2633c99c19f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumeproperties.go +++ /dev/null @@ -1,60 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeProperties struct { - ActualThroughputMibps *float64 `json:"actualThroughputMibps,omitempty"` - AvsDataStore *AvsDataStore `json:"avsDataStore,omitempty"` - BackupId *string `json:"backupId,omitempty"` - BaremetalTenantId *string `json:"baremetalTenantId,omitempty"` - CapacityPoolResourceId *string `json:"capacityPoolResourceId,omitempty"` - CloneProgress *int64 `json:"cloneProgress,omitempty"` - CoolAccess *bool `json:"coolAccess,omitempty"` - CoolnessPeriod *int64 `json:"coolnessPeriod,omitempty"` - CreationToken string `json:"creationToken"` - DataProtection *VolumePropertiesDataProtection `json:"dataProtection,omitempty"` - DataStoreResourceId *[]string `json:"dataStoreResourceId,omitempty"` - DefaultGroupQuotaInKiBs *int64 `json:"defaultGroupQuotaInKiBs,omitempty"` - DefaultUserQuotaInKiBs *int64 `json:"defaultUserQuotaInKiBs,omitempty"` - DeleteBaseSnapshot *bool `json:"deleteBaseSnapshot,omitempty"` - EnableSubvolumes *EnableSubvolumes `json:"enableSubvolumes,omitempty"` - Encrypted *bool `json:"encrypted,omitempty"` - EncryptionKeySource *EncryptionKeySource `json:"encryptionKeySource,omitempty"` - ExportPolicy *VolumePropertiesExportPolicy `json:"exportPolicy,omitempty"` - FileAccessLogs *FileAccessLogs `json:"fileAccessLogs,omitempty"` - FileSystemId *string `json:"fileSystemId,omitempty"` - IsDefaultQuotaEnabled *bool `json:"isDefaultQuotaEnabled,omitempty"` - IsLargeVolume *bool `json:"isLargeVolume,omitempty"` - IsRestoring *bool `json:"isRestoring,omitempty"` - KerberosEnabled *bool `json:"kerberosEnabled,omitempty"` - KeyVaultPrivateEndpointResourceId *string `json:"keyVaultPrivateEndpointResourceId,omitempty"` - LdapEnabled *bool `json:"ldapEnabled,omitempty"` - MaximumNumberOfFiles *int64 `json:"maximumNumberOfFiles,omitempty"` - MountTargets *[]MountTargetProperties `json:"mountTargets,omitempty"` - NetworkFeatures *NetworkFeatures `json:"networkFeatures,omitempty"` - NetworkSiblingSetId *string `json:"networkSiblingSetId,omitempty"` - OriginatingResourceId *string `json:"originatingResourceId,omitempty"` - PlacementRules *[]PlacementKeyValuePairs `json:"placementRules,omitempty"` - ProtocolTypes *[]string `json:"protocolTypes,omitempty"` - ProvisionedAvailabilityZone *string `json:"provisionedAvailabilityZone,omitempty"` - ProvisioningState *string `json:"provisioningState,omitempty"` - ProximityPlacementGroup *string `json:"proximityPlacementGroup,omitempty"` - SecurityStyle *SecurityStyle `json:"securityStyle,omitempty"` - ServiceLevel *ServiceLevel `json:"serviceLevel,omitempty"` - SmbAccessBasedEnumeration *SmbAccessBasedEnumeration `json:"smbAccessBasedEnumeration,omitempty"` - SmbContinuouslyAvailable *bool `json:"smbContinuouslyAvailable,omitempty"` - SmbEncryption *bool `json:"smbEncryption,omitempty"` - SmbNonBrowsable *SmbNonBrowsable `json:"smbNonBrowsable,omitempty"` - SnapshotDirectoryVisible *bool `json:"snapshotDirectoryVisible,omitempty"` - SnapshotId *string `json:"snapshotId,omitempty"` - StorageToNetworkProximity *VolumeStorageToNetworkProximity `json:"storageToNetworkProximity,omitempty"` - SubnetId string `json:"subnetId"` - T2Network *string `json:"t2Network,omitempty"` - ThroughputMibps *float64 `json:"throughputMibps,omitempty"` - UnixPermissions *string `json:"unixPermissions,omitempty"` - UsageThreshold int64 `json:"usageThreshold"` - VolumeGroupName *string `json:"volumeGroupName,omitempty"` - VolumeSpecName *string `json:"volumeSpecName,omitempty"` - VolumeType *string `json:"volumeType,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesdataprotection.go b/resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesdataprotection.go deleted file mode 100644 index fcf952952d2..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesdataprotection.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesDataProtection struct { - Backup *VolumeBackupProperties `json:"backup,omitempty"` - Replication *ReplicationObject `json:"replication,omitempty"` - Snapshot *VolumeSnapshotProperties `json:"snapshot,omitempty"` - VolumeRelocation *VolumeRelocationProperties `json:"volumeRelocation,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesexportpolicy.go b/resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesexportpolicy.go deleted file mode 100644 index fda5f4739de..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumepropertiesexportpolicy.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumePropertiesExportPolicy struct { - Rules *[]ExportPolicyRule `json:"rules,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumerelocationproperties.go b/resource-manager/netapp/2022-11-01/volumes/model_volumerelocationproperties.go deleted file mode 100644 index 23274832779..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumerelocationproperties.go +++ /dev/null @@ -1,9 +0,0 @@ -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 VolumeRelocationProperties struct { - ReadyToBeFinalized *bool `json:"readyToBeFinalized,omitempty"` - RelocationRequested *bool `json:"relocationRequested,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/model_volumesnapshotproperties.go b/resource-manager/netapp/2022-11-01/volumes/model_volumesnapshotproperties.go deleted file mode 100644 index 48aba2acce0..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/model_volumesnapshotproperties.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumes - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeSnapshotProperties struct { - SnapshotPolicyId *string `json:"snapshotPolicyId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumes/predicates.go b/resource-manager/netapp/2022-11-01/volumes/predicates.go deleted file mode 100644 index fcc54ae5e26..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/predicates.go +++ /dev/null @@ -1,37 +0,0 @@ -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 VolumeOperationPredicate struct { - Etag *string - Id *string - Location *string - Name *string - Type *string -} - -func (p VolumeOperationPredicate) Matches(input Volume) bool { - - if p.Etag != nil && (input.Etag == nil || *p.Etag != *input.Etag) { - return false - } - - if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { - return false - } - - if p.Location != nil && *p.Location != input.Location { - return false - } - - if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { - return false - } - - if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { - return false - } - - return true -} diff --git a/resource-manager/netapp/2022-11-01/volumes/version.go b/resource-manager/netapp/2022-11-01/volumes/version.go deleted file mode 100644 index 5378def2e27..00000000000 --- a/resource-manager/netapp/2022-11-01/volumes/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumes - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumes/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/README.md b/resource-manager/netapp/2022-11-01/volumesrelocation/README.md deleted file mode 100644 index de76e570612..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/README.md +++ /dev/null @@ -1,61 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesrelocation` Documentation - -The `volumesrelocation` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/volumesrelocation" -``` - - -### Client Initialization - -```go -client := volumesrelocation.NewVolumesRelocationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRelocationClient.VolumesFinalizeRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesFinalizeRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRelocate` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrelocation.RelocateVolumeRequest{ - // ... -} - - -if err := client.VolumesRelocateThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesRelocationClient.VolumesRevertRelocation` - -```go -ctx := context.TODO() -id := volumesrelocation.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesRevertRelocationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/client.go b/resource-manager/netapp/2022-11-01/volumesrelocation/client.go deleted file mode 100644 index 9170c859f6f..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrelocation - -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 VolumesRelocationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRelocationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRelocationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrelocation", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRelocationClient: %+v", err) - } - - return &VolumesRelocationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go b/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go deleted file mode 100644 index c10d0bf30cd..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrelocation - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume_test.go b/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume_test.go deleted file mode 100644 index 1956a28a604..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrelocation - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesfinalizerelocation.go b/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesfinalizerelocation.go deleted file mode 100644 index 8bc1cc1b39a..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesfinalizerelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesFinalizeRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesFinalizeRelocation ... -func (c VolumesRelocationClient) VolumesFinalizeRelocation(ctx context.Context, id VolumeId) (result VolumesFinalizeRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/finalizeRelocation", 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 -} - -// VolumesFinalizeRelocationThenPoll performs VolumesFinalizeRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesFinalizeRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesFinalizeRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesFinalizeRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesFinalizeRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrelocate.go b/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrelocate.go deleted file mode 100644 index 1207d489ed4..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrelocate.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrelocation - -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 VolumesRelocateOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRelocate ... -func (c VolumesRelocationClient) VolumesRelocate(ctx context.Context, id VolumeId, input RelocateVolumeRequest) (result VolumesRelocateOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/relocate", 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 -} - -// VolumesRelocateThenPoll performs VolumesRelocate then polls until it's completed -func (c VolumesRelocationClient) VolumesRelocateThenPoll(ctx context.Context, id VolumeId, input RelocateVolumeRequest) error { - result, err := c.VolumesRelocate(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRelocate: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRelocate: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrevertrelocation.go b/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrevertrelocation.go deleted file mode 100644 index 0091b1304fd..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/method_volumesrevertrelocation.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesrelocation - -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 VolumesRevertRelocationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevertRelocation ... -func (c VolumesRelocationClient) VolumesRevertRelocation(ctx context.Context, id VolumeId) (result VolumesRevertRelocationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revertRelocation", 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 -} - -// VolumesRevertRelocationThenPoll performs VolumesRevertRelocation then polls until it's completed -func (c VolumesRelocationClient) VolumesRevertRelocationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesRevertRelocation(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesRevertRelocation: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevertRelocation: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/model_relocatevolumerequest.go b/resource-manager/netapp/2022-11-01/volumesrelocation/model_relocatevolumerequest.go deleted file mode 100644 index 25cb3a56801..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/model_relocatevolumerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrelocation - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type RelocateVolumeRequest struct { - CreationToken *string `json:"creationToken,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesrelocation/version.go b/resource-manager/netapp/2022-11-01/volumesrelocation/version.go deleted file mode 100644 index ce14ef18a36..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrelocation/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrelocation - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrelocation/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/README.md b/resource-manager/netapp/2022-11-01/volumesreplication/README.md deleted file mode 100644 index c9e3424f8ae..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/README.md +++ /dev/null @@ -1,139 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesreplication` Documentation - -The `volumesreplication` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/volumesreplication" -``` - - -### Client Initialization - -```go -client := volumesreplication.NewVolumesReplicationClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesReplicationClient.VolumesAuthorizeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.AuthorizeRequest{ - // ... -} - - -if err := client.VolumesAuthorizeReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesBreakReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.BreakReplicationRequest{ - // ... -} - - -if err := client.VolumesBreakReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesDeleteReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesDeleteReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesListReplications` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesListReplications(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReInitializeReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesReInitializeReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReestablishReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesreplication.ReestablishReplicationRequest{ - // ... -} - - -if err := client.VolumesReestablishReplicationThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesReplicationStatus` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -read, err := client.VolumesReplicationStatus(ctx, id) -if err != nil { - // handle the error -} -if model := read.Model; model != nil { - // do something with the model/response object -} -``` - - -### Example Usage: `VolumesReplicationClient.VolumesResyncReplication` - -```go -ctx := context.TODO() -id := volumesreplication.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -if err := client.VolumesResyncReplicationThenPoll(ctx, id); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/client.go b/resource-manager/netapp/2022-11-01/volumesreplication/client.go deleted file mode 100644 index 278506e484e..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesreplication - -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 VolumesReplicationClient struct { - Client *resourcemanager.Client -} - -func NewVolumesReplicationClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesReplicationClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesreplication", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesReplicationClient: %+v", err) - } - - return &VolumesReplicationClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/constants.go b/resource-manager/netapp/2022-11-01/volumesreplication/constants.go deleted file mode 100644 index 2e5196391b7..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/constants.go +++ /dev/null @@ -1,180 +0,0 @@ -package volumesreplication - -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 EndpointType string - -const ( - EndpointTypeDst EndpointType = "dst" - EndpointTypeSrc EndpointType = "src" -) - -func PossibleValuesForEndpointType() []string { - return []string{ - string(EndpointTypeDst), - string(EndpointTypeSrc), - } -} - -func (s *EndpointType) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseEndpointType(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseEndpointType(input string) (*EndpointType, error) { - vals := map[string]EndpointType{ - "dst": EndpointTypeDst, - "src": EndpointTypeSrc, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := EndpointType(input) - return &out, nil -} - -type 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 ( - RelationshipStatusIdle RelationshipStatus = "Idle" - RelationshipStatusTransferring RelationshipStatus = "Transferring" -) - -func PossibleValuesForRelationshipStatus() []string { - return []string{ - string(RelationshipStatusIdle), - string(RelationshipStatusTransferring), - } -} - -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{ - "idle": RelationshipStatusIdle, - "transferring": RelationshipStatusTransferring, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := RelationshipStatus(input) - return &out, nil -} - -type ReplicationSchedule string - -const ( - ReplicationScheduleDaily ReplicationSchedule = "daily" - ReplicationScheduleHourly ReplicationSchedule = "hourly" - ReplicationScheduleOneZerominutely ReplicationSchedule = "_10minutely" -) - -func PossibleValuesForReplicationSchedule() []string { - return []string{ - string(ReplicationScheduleDaily), - string(ReplicationScheduleHourly), - string(ReplicationScheduleOneZerominutely), - } -} - -func (s *ReplicationSchedule) UnmarshalJSON(bytes []byte) error { - var decoded string - if err := json.Unmarshal(bytes, &decoded); err != nil { - return fmt.Errorf("unmarshaling: %+v", err) - } - out, err := parseReplicationSchedule(decoded) - if err != nil { - return fmt.Errorf("parsing %q: %+v", decoded, err) - } - *s = *out - return nil -} - -func parseReplicationSchedule(input string) (*ReplicationSchedule, error) { - vals := map[string]ReplicationSchedule{ - "daily": ReplicationScheduleDaily, - "hourly": ReplicationScheduleHourly, - "_10minutely": ReplicationScheduleOneZerominutely, - } - if v, ok := vals[strings.ToLower(input)]; ok { - return &v, nil - } - - // otherwise presume it's an undefined value and best-effort it - out := ReplicationSchedule(input) - return &out, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go b/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go deleted file mode 100644 index c68d5f31c45..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesreplication - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/volumesreplication/id_volume_test.go b/resource-manager/netapp/2022-11-01/volumesreplication/id_volume_test.go deleted file mode 100644 index b7b6501115b..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesreplication - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesauthorizereplication.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesauthorizereplication.go deleted file mode 100644 index 591d7c626ab..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesauthorizereplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesAuthorizeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesAuthorizeReplication ... -func (c VolumesReplicationClient) VolumesAuthorizeReplication(ctx context.Context, id VolumeId, input AuthorizeRequest) (result VolumesAuthorizeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/authorizeReplication", 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 -} - -// VolumesAuthorizeReplicationThenPoll performs VolumesAuthorizeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesAuthorizeReplicationThenPoll(ctx context.Context, id VolumeId, input AuthorizeRequest) error { - result, err := c.VolumesAuthorizeReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesAuthorizeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesAuthorizeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesbreakreplication.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesbreakreplication.go deleted file mode 100644 index 280008e8175..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesbreakreplication.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesreplication - -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 VolumesBreakReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesBreakReplication ... -func (c VolumesReplicationClient) VolumesBreakReplication(ctx context.Context, id VolumeId, input BreakReplicationRequest) (result VolumesBreakReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/breakReplication", 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 -} - -// VolumesBreakReplicationThenPoll performs VolumesBreakReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesBreakReplicationThenPoll(ctx context.Context, id VolumeId, input BreakReplicationRequest) error { - result, err := c.VolumesBreakReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesBreakReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesBreakReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesdeletereplication.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesdeletereplication.go deleted file mode 100644 index cda9737c512..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesdeletereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesDeleteReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesDeleteReplication ... -func (c VolumesReplicationClient) VolumesDeleteReplication(ctx context.Context, id VolumeId) (result VolumesDeleteReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/deleteReplication", 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 -} - -// VolumesDeleteReplicationThenPoll performs VolumesDeleteReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesDeleteReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesDeleteReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesDeleteReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesDeleteReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumeslistreplications.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumeslistreplications.go deleted file mode 100644 index c85aaaca41b..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumeslistreplications.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesListReplicationsOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ListReplications -} - -// VolumesListReplications ... -func (c VolumesReplicationClient) VolumesListReplications(ctx context.Context, id VolumeId) (result VolumesListReplicationsOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/listReplications", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreestablishreplication.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreestablishreplication.go deleted file mode 100644 index 047fc04a7f9..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreestablishreplication.go +++ /dev/null @@ -1,73 +0,0 @@ -package volumesreplication - -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 VolumesReestablishReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReestablishReplication ... -func (c VolumesReplicationClient) VolumesReestablishReplication(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) (result VolumesReestablishReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reestablishReplication", 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 -} - -// VolumesReestablishReplicationThenPoll performs VolumesReestablishReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReestablishReplicationThenPoll(ctx context.Context, id VolumeId, input ReestablishReplicationRequest) error { - result, err := c.VolumesReestablishReplication(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesReestablishReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReestablishReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreinitializereplication.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreinitializereplication.go deleted file mode 100644 index 3f479bf637a..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreinitializereplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesReInitializeReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesReInitializeReplication ... -func (c VolumesReplicationClient) VolumesReInitializeReplication(ctx context.Context, id VolumeId) (result VolumesReInitializeReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/reinitializeReplication", 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 -} - -// VolumesReInitializeReplicationThenPoll performs VolumesReInitializeReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesReInitializeReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesReInitializeReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesReInitializeReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesReInitializeReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreplicationstatus.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreplicationstatus.go deleted file mode 100644 index af1138c5648..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesreplicationstatus.go +++ /dev/null @@ -1,52 +0,0 @@ -package volumesreplication - -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 VolumesReplicationStatusOperationResponse struct { - HttpResponse *http.Response - OData *odata.OData - Model *ReplicationStatus -} - -// VolumesReplicationStatus ... -func (c VolumesReplicationClient) VolumesReplicationStatus(ctx context.Context, id VolumeId) (result VolumesReplicationStatusOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusOK, - }, - HttpMethod: http.MethodGet, - Path: fmt.Sprintf("%s/replicationStatus", 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 - } - - if err = resp.Unmarshal(&result.Model); err != nil { - return - } - - return -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesresyncreplication.go b/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesresyncreplication.go deleted file mode 100644 index 23e1a66f518..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/method_volumesresyncreplication.go +++ /dev/null @@ -1,70 +0,0 @@ -package volumesreplication - -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 VolumesResyncReplicationOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesResyncReplication ... -func (c VolumesReplicationClient) VolumesResyncReplication(ctx context.Context, id VolumeId) (result VolumesResyncReplicationOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/resyncReplication", 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 -} - -// VolumesResyncReplicationThenPoll performs VolumesResyncReplication then polls until it's completed -func (c VolumesReplicationClient) VolumesResyncReplicationThenPoll(ctx context.Context, id VolumeId) error { - result, err := c.VolumesResyncReplication(ctx, id) - if err != nil { - return fmt.Errorf("performing VolumesResyncReplication: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesResyncReplication: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/model_authorizerequest.go b/resource-manager/netapp/2022-11-01/volumesreplication/model_authorizerequest.go deleted file mode 100644 index ff1cefa31ef..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/model_authorizerequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type AuthorizeRequest struct { - RemoteVolumeResourceId *string `json:"remoteVolumeResourceId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/model_breakreplicationrequest.go b/resource-manager/netapp/2022-11-01/volumesreplication/model_breakreplicationrequest.go deleted file mode 100644 index b6a0a179a9c..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/model_breakreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type BreakReplicationRequest struct { - ForceBreakReplication *bool `json:"forceBreakReplication,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/model_listreplications.go b/resource-manager/netapp/2022-11-01/volumesreplication/model_listreplications.go deleted file mode 100644 index 7929ea4ace4..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/model_listreplications.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ListReplications struct { - Value *[]Replication `json:"value,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/model_reestablishreplicationrequest.go b/resource-manager/netapp/2022-11-01/volumesreplication/model_reestablishreplicationrequest.go deleted file mode 100644 index 193b71f1490..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/model_reestablishreplicationrequest.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReestablishReplicationRequest struct { - SourceVolumeId *string `json:"sourceVolumeId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/model_replication.go b/resource-manager/netapp/2022-11-01/volumesreplication/model_replication.go deleted file mode 100644 index 06e345fdb5e..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/model_replication.go +++ /dev/null @@ -1,11 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type Replication struct { - EndpointType *EndpointType `json:"endpointType,omitempty"` - RemoteVolumeRegion *string `json:"remoteVolumeRegion,omitempty"` - RemoteVolumeResourceId string `json:"remoteVolumeResourceId"` - ReplicationSchedule *ReplicationSchedule `json:"replicationSchedule,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/model_replicationstatus.go b/resource-manager/netapp/2022-11-01/volumesreplication/model_replicationstatus.go deleted file mode 100644 index 2a79dddf7a4..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/model_replicationstatus.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type ReplicationStatus struct { - ErrorMessage *string `json:"errorMessage,omitempty"` - Healthy *bool `json:"healthy,omitempty"` - MirrorState *MirrorState `json:"mirrorState,omitempty"` - RelationshipStatus *RelationshipStatus `json:"relationshipStatus,omitempty"` - TotalProgress *string `json:"totalProgress,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesreplication/version.go b/resource-manager/netapp/2022-11-01/volumesreplication/version.go deleted file mode 100644 index 81c33f262fb..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesreplication/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesreplication - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesreplication/%s", defaultApiVersion) -} diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/README.md b/resource-manager/netapp/2022-11-01/volumesrevert/README.md deleted file mode 100644 index 69eb4d379cf..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -## `github.com/hashicorp/go-azure-sdk/resource-manager/netapp/2022-11-01/volumesrevert` Documentation - -The `volumesrevert` SDK allows for interaction with the Azure Resource Manager Service `netapp` (API Version `2022-11-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/2022-11-01/volumesrevert" -``` - - -### Client Initialization - -```go -client := volumesrevert.NewVolumesRevertClientWithBaseURI("https://management.azure.com") -client.Client.Authorizer = authorizer -``` - - -### Example Usage: `VolumesRevertClient.VolumesRevert` - -```go -ctx := context.TODO() -id := volumesrevert.NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - -payload := volumesrevert.VolumeRevert{ - // ... -} - - -if err := client.VolumesRevertThenPoll(ctx, id, payload); err != nil { - // handle the error -} -``` diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/client.go b/resource-manager/netapp/2022-11-01/volumesrevert/client.go deleted file mode 100644 index fa2bad78d7b..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/client.go +++ /dev/null @@ -1,26 +0,0 @@ -package volumesrevert - -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 VolumesRevertClient struct { - Client *resourcemanager.Client -} - -func NewVolumesRevertClientWithBaseURI(sdkApi sdkEnv.Api) (*VolumesRevertClient, error) { - client, err := resourcemanager.NewResourceManagerClient(sdkApi, "volumesrevert", defaultApiVersion) - if err != nil { - return nil, fmt.Errorf("instantiating VolumesRevertClient: %+v", err) - } - - return &VolumesRevertClient{ - Client: client, - }, nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go b/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go deleted file mode 100644 index 576a30b9904..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/id_volume.go +++ /dev/null @@ -1,143 +0,0 @@ -package volumesrevert - -import ( - "fmt" - "strings" - - "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. - -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", "netAppAccountValue"), - resourceids.StaticSegment("staticCapacityPools", "capacityPools", "capacityPools"), - resourceids.UserSpecifiedSegment("capacityPoolName", "capacityPoolValue"), - resourceids.StaticSegment("staticVolumes", "volumes", "volumes"), - resourceids.UserSpecifiedSegment("volumeName", "volumeValue"), - } -} - -// String returns a human-readable description of this Volume ID -func (id VolumeId) String() string { - components := []string{ - fmt.Sprintf("Subscription: %q", id.SubscriptionId), - fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), - fmt.Sprintf("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/resource-manager/netapp/2022-11-01/volumesrevert/id_volume_test.go b/resource-manager/netapp/2022-11-01/volumesrevert/id_volume_test.go deleted file mode 100644 index 46df3f272f2..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/id_volume_test.go +++ /dev/null @@ -1,372 +0,0 @@ -package volumesrevert - -import ( - "testing" - - "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. - -var _ resourceids.ResourceId = VolumeId{} - -func TestNewVolumeID(t *testing.T) { - id := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue") - - if id.SubscriptionId != "12345678-1234-9876-4563-123456789012" { - t.Fatalf("Expected %q but got %q for Segment 'SubscriptionId'", id.SubscriptionId, "12345678-1234-9876-4563-123456789012") - } - - if id.ResourceGroupName != "example-resource-group" { - t.Fatalf("Expected %q but got %q for Segment 'ResourceGroupName'", id.ResourceGroupName, "example-resource-group") - } - - if id.NetAppAccountName != "netAppAccountValue" { - t.Fatalf("Expected %q but got %q for Segment 'NetAppAccountName'", id.NetAppAccountName, "netAppAccountValue") - } - - if id.CapacityPoolName != "capacityPoolValue" { - t.Fatalf("Expected %q but got %q for Segment 'CapacityPoolName'", id.CapacityPoolName, "capacityPoolValue") - } - - if id.VolumeName != "volumeValue" { - t.Fatalf("Expected %q but got %q for Segment 'VolumeName'", id.VolumeName, "volumeValue") - } -} - -func TestFormatVolumeID(t *testing.T) { - actual := NewVolumeID("12345678-1234-9876-4563-123456789012", "example-resource-group", "netAppAccountValue", "capacityPoolValue", "volumeValue").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue" - if actual != expected { - t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) - } -} - -func TestParseVolumeID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestParseVolumeIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *VolumeId - }{ - { - // Incomplete URI - Input: "", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe", - Error: true, - }, - { - // Incomplete URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes", - Error: true, - }, - { - // Incomplete URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs", - Error: true, - }, - { - // Valid URI - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "example-resource-group", - NetAppAccountName: "netAppAccountValue", - CapacityPoolName: "capacityPoolValue", - VolumeName: "volumeValue", - }, - }, - { - // Invalid (Valid Uri with Extra segment) - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.NetApp/netAppAccounts/netAppAccountValue/capacityPools/capacityPoolValue/volumes/volumeValue/extra", - Error: true, - }, - { - // Valid URI (mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe", - Expected: &VolumeId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", - NetAppAccountName: "nEtApPaCcOuNtVaLuE", - CapacityPoolName: "cApAcItYpOoLvAlUe", - VolumeName: "vOlUmEvAlUe", - }, - }, - { - // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) - Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.nEtApP/nEtApPaCcOuNtS/nEtApPaCcOuNtVaLuE/cApAcItYpOoLs/cApAcItYpOoLvAlUe/vOlUmEs/vOlUmEvAlUe/extra", - Error: true, - }, - } - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := ParseVolumeIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %+v", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - - if actual.ResourceGroupName != v.Expected.ResourceGroupName { - t.Fatalf("Expected %q but got %q for ResourceGroupName", v.Expected.ResourceGroupName, actual.ResourceGroupName) - } - - if actual.NetAppAccountName != v.Expected.NetAppAccountName { - t.Fatalf("Expected %q but got %q for NetAppAccountName", v.Expected.NetAppAccountName, actual.NetAppAccountName) - } - - if actual.CapacityPoolName != v.Expected.CapacityPoolName { - t.Fatalf("Expected %q but got %q for CapacityPoolName", v.Expected.CapacityPoolName, actual.CapacityPoolName) - } - - if actual.VolumeName != v.Expected.VolumeName { - t.Fatalf("Expected %q but got %q for VolumeName", v.Expected.VolumeName, actual.VolumeName) - } - - } -} - -func TestSegmentsForVolumeId(t *testing.T) { - segments := VolumeId{}.Segments() - if len(segments) == 0 { - t.Fatalf("VolumeId has no segments") - } - - uniqueNames := make(map[string]struct{}, 0) - for _, segment := range segments { - uniqueNames[segment.Name] = struct{}{} - } - if len(uniqueNames) != len(segments) { - t.Fatalf("Expected the Segments to be unique but got %q unique segments and %d total segments", len(uniqueNames), len(segments)) - } -} diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/method_volumesrevert.go b/resource-manager/netapp/2022-11-01/volumesrevert/method_volumesrevert.go deleted file mode 100644 index 0be129fdd47..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/method_volumesrevert.go +++ /dev/null @@ -1,74 +0,0 @@ -package volumesrevert - -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 VolumesRevertOperationResponse struct { - Poller pollers.Poller - HttpResponse *http.Response - OData *odata.OData -} - -// VolumesRevert ... -func (c VolumesRevertClient) VolumesRevert(ctx context.Context, id VolumeId, input VolumeRevert) (result VolumesRevertOperationResponse, err error) { - opts := client.RequestOptions{ - ContentType: "application/json; charset=utf-8", - ExpectedStatusCodes: []int{ - http.StatusAccepted, - http.StatusOK, - }, - HttpMethod: http.MethodPost, - Path: fmt.Sprintf("%s/revert", 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 -} - -// VolumesRevertThenPoll performs VolumesRevert then polls until it's completed -func (c VolumesRevertClient) VolumesRevertThenPoll(ctx context.Context, id VolumeId, input VolumeRevert) error { - result, err := c.VolumesRevert(ctx, id, input) - if err != nil { - return fmt.Errorf("performing VolumesRevert: %+v", err) - } - - if err := result.Poller.PollUntilDone(ctx); err != nil { - return fmt.Errorf("polling after VolumesRevert: %+v", err) - } - - return nil -} diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/model_volumerevert.go b/resource-manager/netapp/2022-11-01/volumesrevert/model_volumerevert.go deleted file mode 100644 index c5adf461cf8..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/model_volumerevert.go +++ /dev/null @@ -1,8 +0,0 @@ -package volumesrevert - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -type VolumeRevert struct { - SnapshotId *string `json:"snapshotId,omitempty"` -} diff --git a/resource-manager/netapp/2022-11-01/volumesrevert/version.go b/resource-manager/netapp/2022-11-01/volumesrevert/version.go deleted file mode 100644 index db907da14b9..00000000000 --- a/resource-manager/netapp/2022-11-01/volumesrevert/version.go +++ /dev/null @@ -1,12 +0,0 @@ -package volumesrevert - -import "fmt" - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See NOTICE.txt in the project root for license information. - -const defaultApiVersion = "2022-11-01" - -func userAgent() string { - return fmt.Sprintf("hashicorp/go-azure-sdk/volumesrevert/%s", defaultApiVersion) -}