From 4ddd9bdbc23b257e21bd40df1bac2040d995c94e Mon Sep 17 00:00:00 2001 From: hc-github-team-tf-azure <> Date: Tue, 20 May 2025 15:33:45 +0000 Subject: [PATCH] Updating based on f11d1cf7f --- .../2024-11-01/availabilitysets/README.md | 220 ++ .../2024-11-01/availabilitysets/client.go | 26 + .../2024-11-01/availabilitysets/constants.go | 54 + ...cancelmigrationtovirtualmachinescaleset.go | 48 + .../method_converttovirtualmachinescaleset.go | 74 + .../availabilitysets/method_createorupdate.go | 58 + .../availabilitysets/method_delete.go | 48 + .../2024-11-01/availabilitysets/method_get.go | 54 + .../availabilitysets/method_list.go | 106 + .../method_listavailablesizes.go | 55 + .../method_listbysubscription.go | 135 + ..._startmigrationtovirtualmachinescaleset.go | 52 + .../availabilitysets/method_update.go | 58 + ...lidatemigrationtovirtualmachinescaleset.go | 52 + .../availabilitysets/model_availabilityset.go | 14 + .../model_availabilitysetproperties.go | 14 + .../model_availabilitysetupdate.go | 10 + ...el_converttovirtualmachinescalesetinput.go | 8 + ...model_defaultvirtualmachinescalesetinfo.go | 9 + .../model_eventgridandresourcegraph.go | 8 + .../model_instanceviewstatus.go | 30 + ...el_migratetovirtualmachinescalesetinput.go | 8 + ...eduledeventsadditionalpublishingtargets.go | 8 + .../model_scheduledeventspolicy.go | 10 + .../2024-11-01/availabilitysets/model_sku.go | 10 + .../availabilitysets/model_subresource.go | 8 + .../model_userinitiatedreboot.go | 8 + .../model_userinitiatedredeploy.go | 8 + ...del_virtualmachinescalesetmigrationinfo.go | 9 + .../model_virtualmachinesize.go | 13 + .../model_virtualmachinesizelistresult.go | 8 + .../2024-11-01/availabilitysets/predicates.go | 32 + .../2024-11-01/availabilitysets/version.go | 10 + .../2024-11-01/capacityreservation/README.md | 37 + .../2024-11-01/capacityreservation/client.go | 26 + .../capacityreservation/constants.go | 54 + .../id_capacityreservationgroup.go | 130 + .../id_capacityreservationgroup_test.go | 282 ++ .../method_listbycapacityreservationgroup.go | 105 + .../model_capacityreservation.go | 19 + .../model_capacityreservationinstanceview.go | 9 + .../model_capacityreservationproperties.go | 44 + .../model_capacityreservationutilization.go | 9 + .../model_instanceviewstatus.go | 30 + .../capacityreservation/model_sku.go | 10 + .../model_subresourcereadonly.go | 8 + .../capacityreservation/predicates.go | 32 + .../2024-11-01/capacityreservation/version.go | 10 + .../capacityreservationgroups/README.md | 129 + .../capacityreservationgroups/client.go | 26 + .../capacityreservationgroups/constants.go | 177 ++ .../id_capacityreservationgroup.go | 130 + .../id_capacityreservationgroup_test.go | 282 ++ .../method_createorupdate.go | 58 + .../method_delete.go | 47 + .../capacityreservationgroups/method_get.go | 83 + .../method_listbyresourcegroup.go | 135 + .../method_listbysubscription.go | 139 + .../method_update.go | 57 + .../model_capacityreservationgroup.go | 18 + ...el_capacityreservationgroupinstanceview.go | 9 + ...odel_capacityreservationgroupproperties.go | 11 + .../model_capacityreservationgroupupdate.go | 9 + ...capacityreservationinstanceviewwithname.go | 10 + .../model_capacityreservationutilization.go | 9 + .../model_instanceviewstatus.go | 30 + .../model_resourcesharingprofile.go | 8 + .../model_subresource.go | 8 + .../model_subresourcereadonly.go | 8 + .../capacityreservationgroups/predicates.go | 32 + .../capacityreservationgroups/version.go | 10 + .../2024-11-01/capacityreservations/README.md | 82 + .../2024-11-01/capacityreservations/client.go | 26 + .../capacityreservations/constants.go | 92 + .../id_capacityreservation.go | 139 + .../id_capacityreservation_test.go | 327 ++ .../method_createorupdate.go | 75 + .../capacityreservations/method_delete.go | 71 + .../capacityreservations/method_get.go | 83 + .../capacityreservations/method_update.go | 75 + .../model_capacityreservation.go | 19 + .../model_capacityreservationinstanceview.go | 9 + .../model_capacityreservationproperties.go | 44 + .../model_capacityreservationupdate.go | 10 + .../model_capacityreservationutilization.go | 9 + .../model_instanceviewstatus.go | 30 + .../capacityreservations/model_sku.go | 10 + .../model_subresourcereadonly.go | 8 + .../capacityreservations/version.go | 10 + resource-manager/compute/2024-11-01/client.go | 244 ++ .../2024-11-01/dedicatedhost/README.md | 78 + .../2024-11-01/dedicatedhost/client.go | 26 + .../2024-11-01/dedicatedhost/constants.go | 98 + .../method_listavailablesizes.go | 55 + .../dedicatedhost/method_listbyhostgroup.go | 106 + .../dedicatedhost/method_redeploy.go | 70 + .../dedicatedhost/method_restart.go | 70 + .../dedicatedhost/model_dedicatedhost.go | 14 + .../model_dedicatedhostallocatablevm.go | 9 + .../model_dedicatedhostavailablecapacity.go | 8 + .../model_dedicatedhostinstanceview.go | 10 + .../model_dedicatedhostproperties.go | 46 + .../model_dedicatedhostsizelistresult.go | 8 + .../dedicatedhost/model_instanceviewstatus.go | 30 + .../2024-11-01/dedicatedhost/model_sku.go | 10 + .../model_subresourcereadonly.go | 8 + .../2024-11-01/dedicatedhost/predicates.go | 32 + .../2024-11-01/dedicatedhost/version.go | 10 + .../2024-11-01/dedicatedhostgroups/README.md | 129 + .../2024-11-01/dedicatedhostgroups/client.go | 26 + .../dedicatedhostgroups/constants.go | 95 + .../method_createorupdate.go | 59 + .../dedicatedhostgroups/method_delete.go | 48 + .../dedicatedhostgroups/method_get.go | 84 + .../method_listbyresourcegroup.go | 106 + .../method_listbysubscription.go | 106 + .../dedicatedhostgroups/method_update.go | 58 + .../model_dedicatedhostallocatablevm.go | 9 + .../model_dedicatedhostavailablecapacity.go | 8 + .../model_dedicatedhostgroup.go | 18 + .../model_dedicatedhostgroupinstanceview.go | 8 + .../model_dedicatedhostgroupproperties.go | 12 + ...stgrouppropertiesadditionalcapabilities.go | 8 + .../model_dedicatedhostgroupupdate.go | 14 + ...model_dedicatedhostinstanceviewwithname.go | 11 + .../model_instanceviewstatus.go | 30 + .../model_subresourcereadonly.go | 8 + .../dedicatedhostgroups/predicates.go | 32 + .../2024-11-01/dedicatedhostgroups/version.go | 10 + .../2024-11-01/dedicatedhosts/README.md | 83 + .../2024-11-01/dedicatedhosts/client.go | 26 + .../2024-11-01/dedicatedhosts/constants.go | 139 + .../dedicatedhosts/method_createorupdate.go | 76 + .../dedicatedhosts/method_delete.go | 72 + .../2024-11-01/dedicatedhosts/method_get.go | 84 + .../dedicatedhosts/method_update.go | 75 + .../dedicatedhosts/model_dedicatedhost.go | 14 + .../model_dedicatedhostallocatablevm.go | 9 + .../model_dedicatedhostavailablecapacity.go | 8 + .../model_dedicatedhostinstanceview.go | 10 + .../model_dedicatedhostproperties.go | 46 + .../model_dedicatedhostupdate.go | 10 + .../model_instanceviewstatus.go | 30 + .../2024-11-01/dedicatedhosts/model_sku.go | 10 + .../model_subresourcereadonly.go | 8 + .../2024-11-01/dedicatedhosts/version.go | 10 + .../compute/2024-11-01/images/README.md | 117 + .../compute/2024-11-01/images/client.go | 26 + .../compute/2024-11-01/images/constants.go | 233 ++ .../compute/2024-11-01/images/id_image.go | 130 + .../2024-11-01/images/id_image_test.go | 282 ++ .../images/method_createorupdate.go | 75 + .../2024-11-01/images/method_delete.go | 71 + .../compute/2024-11-01/images/method_get.go | 83 + .../compute/2024-11-01/images/method_list.go | 106 + .../images/method_listbyresourcegroup.go | 106 + .../2024-11-01/images/method_update.go | 75 + .../compute/2024-11-01/images/model_image.go | 18 + .../2024-11-01/images/model_imagedatadisk.go | 15 + .../2024-11-01/images/model_imageosdisk.go | 16 + .../images/model_imageproperties.go | 11 + .../images/model_imagestorageprofile.go | 10 + .../2024-11-01/images/model_imageupdate.go | 9 + .../2024-11-01/images/model_subresource.go | 8 + .../compute/2024-11-01/images/predicates.go | 32 + .../compute/2024-11-01/images/version.go | 10 + .../compute/2024-11-01/loganalytics/README.md | 54 + .../compute/2024-11-01/loganalytics/client.go | 26 + .../2024-11-01/loganalytics/constants.go | 57 + .../2024-11-01/loganalytics/id_location.go | 121 + .../loganalytics/id_location_test.go | 237 ++ .../method_exportrequestratebyinterval.go | 75 + .../method_exportthrottledrequests.go | 75 + .../model_loganalyticsinputbase.go | 39 + .../model_loganalyticsoperationresult.go | 8 + .../loganalytics/model_loganalyticsoutput.go | 8 + .../model_requestratebyintervalinput.go | 40 + .../2024-11-01/loganalytics/version.go | 10 + .../proximityplacementgroups/README.md | 129 + .../proximityplacementgroups/client.go | 26 + .../proximityplacementgroups/constants.go | 95 + .../id_proximityplacementgroup.go | 130 + .../id_proximityplacementgroup_test.go | 282 ++ .../method_createorupdate.go | 58 + .../proximityplacementgroups/method_delete.go | 46 + .../proximityplacementgroups/method_get.go | 83 + .../method_listbyresourcegroup.go | 106 + .../method_listbysubscription.go | 106 + .../proximityplacementgroups/method_update.go | 57 + .../model_instanceviewstatus.go | 30 + .../model_proximityplacementgroup.go | 18 + ...model_proximityplacementgroupproperties.go | 13 + ...proximityplacementgrouppropertiesintent.go | 8 + .../model_subresourcewithcolocationstatus.go | 9 + .../model_updateresource.go | 8 + .../proximityplacementgroups/predicates.go | 32 + .../proximityplacementgroups/version.go | 10 + .../restorepointcollections/README.md | 125 + .../restorepointcollections/client.go | 26 + .../restorepointcollections/constants.go | 1525 ++++++++++ .../id_restorepointcollection.go | 130 + .../id_restorepointcollection_test.go | 282 ++ .../method_createorupdate.go | 58 + .../restorepointcollections/method_delete.go | 71 + .../restorepointcollections/method_get.go | 83 + .../restorepointcollections/method_list.go | 106 + .../restorepointcollections/method_listall.go | 106 + .../restorepointcollections/method_update.go | 57 + .../model_additionalunattendcontent.go | 11 + .../model_apientityreference.go | 8 + .../model_bootdiagnostics.go | 9 + .../model_diagnosticsprofile.go | 8 + .../model_diskencryptionsettings.go | 10 + .../model_diskrestorepointattributes.go | 10 + .../model_diskrestorepointinstanceview.go | 9 + ...model_diskrestorepointreplicationstatus.go | 9 + .../model_encryptionidentity.go | 8 + .../model_hardwareprofile.go | 9 + .../model_hostendpointsettings.go | 9 + .../model_instanceviewstatus.go | 30 + .../model_keyvaultkeyreference.go | 9 + .../model_keyvaultsecretreference.go | 9 + .../model_linuxconfiguration.go | 12 + .../model_linuxpatchsettings.go | 10 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_manageddiskparameters.go | 11 + .../model_osprofile.go | 16 + .../model_patchsettings.go | 11 + .../model_proxyagentsettings.go | 12 + .../model_restorepoint.go | 11 + .../model_restorepointcollection.go | 13 + .../model_restorepointcollectionproperties.go | 11 + ..._restorepointcollectionsourceproperties.go | 9 + .../model_restorepointcollectionupdate.go | 9 + .../model_restorepointencryption.go | 9 + .../model_restorepointinstanceview.go | 9 + .../model_restorepointproperties.go | 32 + .../model_restorepointsourcemetadata.go | 17 + .../model_restorepointsourcevmdatadisk.go | 14 + .../model_restorepointsourcevmosdisk.go | 15 + ...odel_restorepointsourcevmstorageprofile.go | 10 + .../model_securityprofile.go | 12 + .../model_sshconfiguration.go | 8 + .../model_sshpublickey.go | 9 + .../model_subresource.go | 8 + .../model_uefisettings.go | 9 + .../model_vaultcertificate.go | 9 + .../model_vaultsecretgroup.go | 9 + .../model_vmdisksecurityprofile.go | 9 + .../model_vmsizeproperties.go | 9 + .../model_windowsconfiguration.go | 14 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_winrmconfiguration.go | 8 + .../model_winrmlistener.go | 9 + .../restorepointcollections/predicates.go | 32 + .../restorepointcollections/version.go | 10 + .../2024-11-01/restorepoints/README.md | 65 + .../2024-11-01/restorepoints/client.go | 26 + .../2024-11-01/restorepoints/constants.go | 1525 ++++++++++ .../restorepoints/id_restorepoint.go | 139 + .../restorepoints/id_restorepoint_test.go | 327 ++ .../2024-11-01/restorepoints/method_create.go | 74 + .../2024-11-01/restorepoints/method_delete.go | 71 + .../2024-11-01/restorepoints/method_get.go | 83 + .../model_additionalunattendcontent.go | 11 + .../restorepoints/model_apientityreference.go | 8 + .../restorepoints/model_bootdiagnostics.go | 9 + .../restorepoints/model_diagnosticsprofile.go | 8 + .../model_diskencryptionsettings.go | 10 + .../model_diskrestorepointattributes.go | 10 + .../model_diskrestorepointinstanceview.go | 9 + ...model_diskrestorepointreplicationstatus.go | 9 + .../restorepoints/model_encryptionidentity.go | 8 + .../restorepoints/model_hardwareprofile.go | 9 + .../model_hostendpointsettings.go | 9 + .../restorepoints/model_instanceviewstatus.go | 30 + .../model_keyvaultkeyreference.go | 9 + .../model_keyvaultsecretreference.go | 9 + .../restorepoints/model_linuxconfiguration.go | 12 + .../restorepoints/model_linuxpatchsettings.go | 10 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_manageddiskparameters.go | 11 + .../restorepoints/model_osprofile.go | 16 + .../restorepoints/model_patchsettings.go | 11 + .../restorepoints/model_proxyagentsettings.go | 12 + .../restorepoints/model_restorepoint.go | 11 + .../model_restorepointencryption.go | 9 + .../model_restorepointinstanceview.go | 9 + .../model_restorepointproperties.go | 32 + .../model_restorepointsourcemetadata.go | 17 + .../model_restorepointsourcevmdatadisk.go | 14 + .../model_restorepointsourcevmosdisk.go | 15 + ...odel_restorepointsourcevmstorageprofile.go | 10 + .../restorepoints/model_securityprofile.go | 12 + .../restorepoints/model_sshconfiguration.go | 8 + .../restorepoints/model_sshpublickey.go | 9 + .../restorepoints/model_subresource.go | 8 + .../restorepoints/model_uefisettings.go | 9 + .../restorepoints/model_vaultcertificate.go | 9 + .../restorepoints/model_vaultsecretgroup.go | 9 + .../model_vmdisksecurityprofile.go | 9 + .../restorepoints/model_vmsizeproperties.go | 9 + .../model_windowsconfiguration.go | 14 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../restorepoints/model_winrmconfiguration.go | 8 + .../restorepoints/model_winrmlistener.go | 9 + .../2024-11-01/restorepoints/version.go | 10 + .../2024-11-01/sshpublickeys/README.md | 150 + .../2024-11-01/sshpublickeys/client.go | 26 + .../2024-11-01/sshpublickeys/constants.go | 51 + .../sshpublickeys/id_sshpublickey.go | 130 + .../sshpublickeys/id_sshpublickey_test.go | 282 ++ .../2024-11-01/sshpublickeys/method_create.go | 58 + .../2024-11-01/sshpublickeys/method_delete.go | 47 + .../sshpublickeys/method_generatekeypair.go | 58 + .../2024-11-01/sshpublickeys/method_get.go | 53 + .../method_listbyresourcegroup.go | 106 + .../method_listbysubscription.go | 106 + .../2024-11-01/sshpublickeys/method_update.go | 57 + ...model_sshgeneratekeypairinputparameters.go | 8 + ...model_sshpublickeygeneratekeypairresult.go | 10 + .../model_sshpublickeyresource.go | 13 + .../model_sshpublickeyresourceproperties.go | 8 + .../model_sshpublickeyupdateresource.go | 9 + .../2024-11-01/sshpublickeys/predicates.go | 32 + .../2024-11-01/sshpublickeys/version.go | 10 + .../virtualmachineextensionimages/README.md | 68 + .../virtualmachineextensionimages/client.go | 26 + .../id_publisher.go | 130 + .../id_publisher_test.go | 282 ++ .../virtualmachineextensionimages/id_type.go | 141 + .../id_type_test.go | 357 +++ .../id_version.go | 150 + .../id_version_test.go | 402 +++ .../method_get.go | 53 + .../method_listtypes.go | 54 + .../method_listversions.go | 91 + .../model_virtualmachineextensionimage.go | 13 + ..._virtualmachineextensionimageproperties.go | 12 + .../virtualmachineextensionimages/version.go | 10 + .../virtualmachineextensions/README.md | 98 + .../virtualmachineextensions/client.go | 26 + .../virtualmachineextensions/constants.go | 54 + .../virtualmachineextensions/id_extension.go | 139 + .../id_extension_test.go | 327 ++ .../id_virtualmachine.go | 130 + .../id_virtualmachine_test.go | 282 ++ .../method_createorupdate.go | 75 + .../virtualmachineextensions/method_delete.go | 71 + .../virtualmachineextensions/method_get.go | 83 + .../virtualmachineextensions/method_list.go | 83 + .../virtualmachineextensions/method_update.go | 74 + .../model_instanceviewstatus.go | 30 + .../model_keyvaultsecretreference.go | 9 + .../model_subresource.go | 8 + .../model_virtualmachineextension.go | 13 + ...del_virtualmachineextensioninstanceview.go | 12 + ...model_virtualmachineextensionproperties.go | 20 + ...odel_virtualmachineextensionslistresult.go | 8 + .../model_virtualmachineextensionupdate.go | 9 + ...virtualmachineextensionupdateproperties.go | 17 + .../virtualmachineextensions/version.go | 10 + .../2024-11-01/virtualmachineimages/README.md | 197 ++ .../2024-11-01/virtualmachineimages/client.go | 26 + .../virtualmachineimages/constants.go | 262 ++ .../virtualmachineimages/id_edgezone.go | 130 + .../virtualmachineimages/id_edgezone_test.go | 282 ++ .../id_edgezonepublisher.go | 139 + .../id_edgezonepublisher_test.go | 327 ++ .../virtualmachineimages/id_location.go | 121 + .../virtualmachineimages/id_location_test.go | 237 ++ .../virtualmachineimages/id_offer.go | 141 + .../virtualmachineimages/id_offer_test.go | 357 +++ .../virtualmachineimages/id_offersku.go | 159 + .../virtualmachineimages/id_offersku_test.go | 447 +++ .../id_offerskuversion.go | 168 ++ .../id_offerskuversion_test.go | 492 +++ .../virtualmachineimages/id_publisher.go | 130 + .../virtualmachineimages/id_publisher_test.go | 282 ++ .../2024-11-01/virtualmachineimages/id_sku.go | 150 + .../virtualmachineimages/id_sku_test.go | 402 +++ .../virtualmachineimages/id_skuversion.go | 159 + .../id_skuversion_test.go | 447 +++ .../virtualmachineimages/id_vmimageoffer.go | 150 + .../id_vmimageoffer_test.go | 402 +++ .../method_edgezoneget.go | 53 + .../method_edgezonelist.go | 91 + .../method_edgezonelistoffers.go | 54 + .../method_edgezonelistpublishers.go | 54 + .../method_edgezonelistskus.go | 54 + .../virtualmachineimages/method_get.go | 53 + .../virtualmachineimages/method_list.go | 91 + .../method_listbyedgezone.go | 105 + .../virtualmachineimages/method_listoffers.go | 54 + .../method_listpublishers.go | 54 + .../virtualmachineimages/method_listskus.go | 54 + .../model_alternativeoption.go | 9 + .../model_automaticosupgradeproperties.go | 8 + .../model_datadiskimage.go | 8 + .../model_disallowedconfiguration.go | 8 + .../model_imagedeprecationstatus.go | 28 + .../virtualmachineimages/model_osdiskimage.go | 8 + .../model_purchaseplan.go | 10 + .../model_virtualmachineimage.go | 17 + .../model_virtualmachineimagefeature.go | 9 + .../model_virtualmachineimageproperties.go | 16 + .../model_virtualmachineimageresource.go | 16 + .../virtualmachineimages/predicates.go | 27 + .../virtualmachineimages/version.go | 10 + .../virtualmachineruncommands/README.md | 132 + .../virtualmachineruncommands/client.go | 26 + .../virtualmachineruncommands/constants.go | 151 + .../virtualmachineruncommands/id_location.go | 121 + .../id_location_test.go | 237 ++ .../id_runcommand.go | 130 + .../id_runcommand_test.go | 282 ++ .../id_virtualmachine.go | 130 + .../id_virtualmachine_test.go | 282 ++ .../id_virtualmachineruncommand.go | 139 + .../id_virtualmachineruncommand_test.go | 327 ++ .../method_createorupdate.go | 75 + .../method_delete.go | 71 + .../virtualmachineruncommands/method_get.go | 53 + .../method_getbyvirtualmachine.go | 83 + .../virtualmachineruncommands/method_list.go | 105 + .../method_listbyvirtualmachine.go | 134 + .../method_update.go | 74 + .../model_instanceviewstatus.go | 30 + .../model_runcommanddocument.go | 14 + .../model_runcommanddocumentbase.go | 12 + .../model_runcommandinputparameter.go | 9 + .../model_runcommandmanagedidentity.go | 9 + .../model_runcommandparameterdefinition.go | 11 + .../model_virtualmachineruncommand.go | 13 + ...el_virtualmachineruncommandinstanceview.go | 45 + ...odel_virtualmachineruncommandproperties.go | 21 + ...el_virtualmachineruncommandscriptsource.go | 11 + .../model_virtualmachineruncommandupdate.go | 9 + .../virtualmachineruncommands/predicates.go | 60 + .../virtualmachineruncommands/version.go | 10 + .../2024-11-01/virtualmachines/README.md | 424 +++ .../2024-11-01/virtualmachines/client.go | 26 + .../2024-11-01/virtualmachines/constants.go | 2675 +++++++++++++++++ .../2024-11-01/virtualmachines/id_location.go | 121 + .../virtualmachines/id_location_test.go | 237 ++ .../virtualmachines/id_virtualmachine.go | 130 + .../virtualmachines/id_virtualmachine_test.go | 282 ++ .../virtualmachines/method_assesspatches.go | 71 + .../method_attachdetachdatadisks.go | 75 + .../virtualmachines/method_capture.go | 75 + .../method_converttomanageddisks.go | 70 + .../virtualmachines/method_createorupdate.go | 108 + .../virtualmachines/method_deallocate.go | 99 + .../virtualmachines/method_delete.go | 100 + .../virtualmachines/method_generalize.go | 47 + .../2024-11-01/virtualmachines/method_get.go | 83 + .../virtualmachines/method_installpatches.go | 75 + .../virtualmachines/method_instanceview.go | 54 + .../2024-11-01/virtualmachines/method_list.go | 139 + .../virtualmachines/method_listall.go | 143 + .../method_listavailablesizes.go | 54 + .../virtualmachines/method_listbylocation.go | 105 + .../method_migratetovmscaleset.go | 73 + .../method_performmaintenance.go | 70 + .../virtualmachines/method_poweroff.go | 99 + .../virtualmachines/method_reapply.go | 70 + .../virtualmachines/method_redeploy.go | 70 + .../virtualmachines/method_reimage.go | 74 + .../virtualmachines/method_restart.go | 70 + .../method_retrievebootdiagnosticsdata.go | 83 + .../virtualmachines/method_runcommand.go | 75 + .../method_simulateeviction.go | 47 + .../virtualmachines/method_start.go | 70 + .../virtualmachines/method_update.go | 107 + .../model_additionalcapabilities.go | 9 + .../model_additionalunattendcontent.go | 11 + .../model_apientityreference.go | 8 + .../virtualmachines/model_apierror.go | 12 + .../virtualmachines/model_apierrorbase.go | 10 + .../model_applicationprofile.go | 8 + .../model_attachdetachdatadisksrequest.go | 9 + .../model_availablepatchsummary.go | 45 + .../virtualmachines/model_billingprofile.go | 8 + .../virtualmachines/model_bootdiagnostics.go | 9 + .../model_bootdiagnosticsinstanceview.go | 10 + .../model_capacityreservationprofile.go | 8 + .../virtualmachines/model_datadisk.go | 22 + .../model_datadiskstoattach.go | 13 + .../model_datadiskstodetach.go | 9 + .../model_diagnosticsprofile.go | 8 + .../virtualmachines/model_diffdisksettings.go | 9 + .../model_diskencryptionsettings.go | 10 + .../virtualmachines/model_diskinstanceview.go | 10 + .../model_encryptionidentity.go | 8 + .../model_eventgridandresourcegraph.go | 8 + .../virtualmachines/model_hardwareprofile.go | 9 + .../model_hostendpointsettings.go | 9 + .../virtualmachines/model_imagereference.go | 15 + .../virtualmachines/model_innererror.go | 9 + .../model_instanceviewstatus.go | 30 + .../model_keyvaultkeyreference.go | 9 + .../model_keyvaultsecretreference.go | 9 + .../model_lastpatchinstallationsummary.go | 48 + .../model_linuxconfiguration.go | 12 + .../virtualmachines/model_linuxparameters.go | 11 + .../model_linuxpatchsettings.go | 10 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_maintenanceredeploystatus.go | 68 + .../model_manageddiskparameters.go | 11 + ..._migratevmtovirtualmachinescalesetinput.go | 10 + .../model_networkinterfacereference.go | 9 + ...del_networkinterfacereferenceproperties.go | 9 + .../virtualmachines/model_networkprofile.go | 10 + .../virtualmachines/model_osdisk.go | 19 + .../model_osimagenotificationprofile.go | 9 + .../virtualmachines/model_osprofile.go | 16 + .../model_osprofileprovisioningdata.go | 9 + .../model_patchinstallationdetail.go | 13 + .../virtualmachines/model_patchsettings.go | 11 + .../virtualmachines/model_placement.go | 10 + .../2024-11-01/virtualmachines/model_plan.go | 11 + .../model_proxyagentsettings.go | 12 + .../model_publicipaddresssku.go | 9 + ...model_retrievebootdiagnosticsdataresult.go | 9 + .../virtualmachines/model_runcommandinput.go | 10 + .../model_runcommandinputparameter.go | 9 + .../virtualmachines/model_runcommandresult.go | 8 + ...eduledeventsadditionalpublishingtargets.go | 8 + .../model_scheduledeventspolicy.go | 10 + .../model_scheduledeventsprofile.go | 9 + .../virtualmachines/model_securityprofile.go | 12 + .../virtualmachines/model_sshconfiguration.go | 8 + .../virtualmachines/model_sshpublickey.go | 9 + .../virtualmachines/model_storageprofile.go | 12 + .../virtualmachines/model_subresource.go | 8 + .../model_terminatenotificationprofile.go | 9 + .../virtualmachines/model_uefisettings.go | 9 + .../model_userinitiatedreboot.go | 8 + .../model_userinitiatedredeploy.go | 8 + .../virtualmachines/model_vaultcertificate.go | 9 + .../virtualmachines/model_vaultsecretgroup.go | 9 + .../virtualmachines/model_virtualharddisk.go | 8 + .../virtualmachines/model_virtualmachine.go | 27 + .../model_virtualmachineagentinstanceview.go | 10 + ...model_virtualmachineassesspatchesresult.go | 33 + .../model_virtualmachinecaptureparameters.go | 10 + .../model_virtualmachinecaptureresult.go | 12 + .../model_virtualmachineextension.go | 13 + ...tualmachineextensionhandlerinstanceview.go | 10 + ...del_virtualmachineextensioninstanceview.go | 12 + ...model_virtualmachineextensionproperties.go | 20 + .../model_virtualmachinehealthstatus.go | 8 + ..._virtualmachineinstallpatchesparameters.go | 11 + ...odel_virtualmachineinstallpatchesresult.go | 37 + .../model_virtualmachineinstanceview.go | 24 + .../model_virtualmachineiptag.go | 9 + ...ualmachinenetworkinterfaceconfiguration.go | 9 + ...networkinterfaceconfigurationproperties.go | 19 + ...etworkinterfacednssettingsconfiguration.go | 8 + ...lmachinenetworkinterfaceipconfiguration.go | 9 + ...tworkinterfaceipconfigurationproperties.go | 14 + .../model_virtualmachinepatchstatus.go | 10 + .../model_virtualmachineproperties.go | 52 + ...tualmachinepublicipaddressconfiguration.go | 10 + ...epublicipaddressconfigurationproperties.go | 14 + ...publicipaddressdnssettingsconfiguration.go | 9 + .../model_virtualmachinereimageparameters.go | 10 + .../model_virtualmachinesize.go | 13 + .../model_virtualmachinesizelistresult.go | 8 + ...l_virtualmachinesoftwarepatchproperties.go | 47 + .../model_virtualmachineupdate.go | 17 + .../model_vmdisksecurityprofile.go | 9 + .../model_vmgalleryapplication.go | 13 + .../virtualmachines/model_vmsizeproperties.go | 9 + .../model_windowsconfiguration.go | 14 + .../model_windowsparameters.go | 30 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_winrmconfiguration.go | 8 + .../virtualmachines/model_winrmlistener.go | 9 + .../2024-11-01/virtualmachines/predicates.go | 42 + .../2024-11-01/virtualmachines/version.go | 10 + .../README.md | 99 + .../client.go | 26 + .../id_virtualmachinescaleset.go | 130 + .../id_virtualmachinescaleset_test.go | 282 ++ .../id_virtualmachinescalesetextension.go | 139 + ...id_virtualmachinescalesetextension_test.go | 327 ++ .../method_createorupdate.go | 75 + .../method_delete.go | 71 + .../method_get.go | 83 + .../method_list.go | 105 + .../method_update.go | 75 + .../model_keyvaultsecretreference.go | 9 + .../model_subresource.go | 8 + .../model_virtualmachinescalesetextension.go | 11 + ...rtualmachinescalesetextensionproperties.go | 19 + ...l_virtualmachinescalesetextensionupdate.go | 11 + .../predicates.go | 27 + .../version.go | 10 + .../README.md | 72 + .../client.go | 26 + .../constants.go | 98 + .../id_virtualmachinescaleset.go | 130 + .../id_virtualmachinescaleset_test.go | 282 ++ .../method_cancel.go | 70 + .../method_getlatest.go | 54 + .../method_startextensionupgrade.go | 70 + .../method_startosupgrade.go | 70 + .../model_apierror.go | 12 + .../model_apierrorbase.go | 10 + .../model_innererror.go | 9 + .../model_rollingupgradepolicy.go | 15 + .../model_rollingupgradeprogressinfo.go | 11 + .../model_rollingupgraderunningstatus.go | 41 + .../model_rollingupgradestatusinfo.go | 13 + ...odel_rollingupgradestatusinfoproperties.go | 11 + .../version.go | 10 + .../virtualmachinescalesets/README.md | 437 +++ .../virtualmachinescalesets/client.go | 26 + .../virtualmachinescalesets/constants.go | 2015 +++++++++++++ .../virtualmachinescalesets/id_location.go | 121 + .../id_location_test.go | 237 ++ .../id_virtualmachinescaleset.go | 130 + .../id_virtualmachinescaleset_test.go | 282 ++ .../method_approverollingupgrade.go | 73 + .../method_converttosingleplacementgroup.go | 51 + .../method_createorupdate.go | 108 + .../method_deallocate.go | 103 + .../virtualmachinescalesets/method_delete.go | 100 + .../method_deleteinstances.go | 103 + ...ryservicefabricplatformupdatedomainwalk.go | 91 + .../virtualmachinescalesets/method_get.go | 83 + .../method_getinstanceview.go | 54 + .../method_getosupgradehistory.go | 105 + .../virtualmachinescalesets/method_list.go | 106 + .../virtualmachinescalesets/method_listall.go | 106 + .../method_listbylocation.go | 105 + .../method_listskus.go | 105 + .../method_performmaintenance.go | 74 + .../method_poweroff.go | 103 + .../virtualmachinescalesets/method_reapply.go | 70 + .../method_redeploy.go | 74 + .../virtualmachinescalesets/method_reimage.go | 74 + .../method_reimageall.go | 74 + .../virtualmachinescalesets/method_restart.go | 74 + .../method_setorchestrationservicestate.go | 74 + .../virtualmachinescalesets/method_start.go | 74 + .../virtualmachinescalesets/method_update.go | 107 + .../method_updateinstances.go | 74 + .../model_additionalcapabilities.go | 9 + .../model_additionalunattendcontent.go | 11 + .../model_apientityreference.go | 8 + .../virtualmachinescalesets/model_apierror.go | 12 + .../model_apierrorbase.go | 10 + .../model_applicationprofile.go | 8 + .../model_automaticosupgradepolicy.go | 11 + .../model_automaticrepairspolicy.go | 10 + .../model_automaticzonerebalancingpolicy.go | 10 + .../model_billingprofile.go | 8 + .../model_bootdiagnostics.go | 9 + .../model_capacityreservationprofile.go | 8 + .../model_diagnosticsprofile.go | 8 + .../model_diffdisksettings.go | 9 + .../model_encryptionidentity.go | 8 + .../model_eventgridandresourcegraph.go | 8 + .../model_hostendpointsettings.go | 9 + .../model_imagereference.go | 15 + .../model_innererror.go | 9 + .../model_instanceviewstatus.go | 30 + .../model_keyvaultsecretreference.go | 9 + .../model_linuxconfiguration.go | 12 + .../model_linuxpatchsettings.go | 10 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_orchestrationservicestateinput.go | 9 + .../model_orchestrationservicesummary.go | 9 + .../model_osimagenotificationprofile.go | 9 + .../model_osprofileprovisioningdata.go | 9 + .../model_patchsettings.go | 11 + .../virtualmachinescalesets/model_plan.go | 11 + .../model_prioritymixpolicy.go | 9 + .../model_proxyagentsettings.go | 12 + .../model_publicipaddresssku.go | 9 + .../model_recoverywalkresponse.go | 9 + .../model_resiliencypolicy.go | 10 + .../model_resilientvmcreationpolicy.go | 8 + .../model_resilientvmdeletionpolicy.go | 8 + .../model_rollbackstatusinfo.go | 10 + .../model_rollingupgradepolicy.go | 15 + .../model_rollingupgradeprogressinfo.go | 11 + .../model_scaleinpolicy.go | 10 + ...eduledeventsadditionalpublishingtargets.go | 8 + .../model_scheduledeventspolicy.go | 10 + .../model_scheduledeventsprofile.go | 9 + .../model_securityposturereference.go | 10 + .../model_securityposturereferenceupdate.go | 10 + .../model_securityprofile.go | 12 + .../model_serviceartifactreference.go | 8 + .../virtualmachinescalesets/model_sku.go | 10 + .../model_skuprofile.go | 9 + .../model_skuprofilevmsize.go | 9 + .../model_spotrestorepolicy.go | 9 + .../model_sshconfiguration.go | 8 + .../model_sshpublickey.go | 9 + .../model_subresource.go | 8 + .../model_terminatenotificationprofile.go | 9 + .../model_uefisettings.go | 9 + ...el_upgradeoperationhistoricalstatusinfo.go | 10 + ...operationhistoricalstatusinfoproperties.go | 13 + .../model_upgradeoperationhistorystatus.go | 40 + .../model_upgradepolicy.go | 10 + .../model_userinitiatedreboot.go | 8 + .../model_userinitiatedredeploy.go | 8 + .../model_vaultcertificate.go | 9 + .../model_vaultsecretgroup.go | 9 + .../model_virtualharddisk.go | 8 + .../model_virtualmachinescaleset.go | 25 + .../model_virtualmachinescalesetdatadisk.go | 17 + .../model_virtualmachinescalesetextension.go | 11 + ..._virtualmachinescalesetextensionprofile.go | 9 + ...rtualmachinescalesetextensionproperties.go | 19 + ...l_virtualmachinescalesethardwareprofile.go | 8 + ...odel_virtualmachinescalesetinstanceview.go | 11 + ...hinescalesetinstanceviewstatusessummary.go | 8 + ...l_virtualmachinescalesetipconfiguration.go | 9 + ...achinescalesetipconfigurationproperties.go | 15 + .../model_virtualmachinescalesetiptag.go | 9 + ...ualmachinescalesetmanageddiskparameters.go | 10 + ...tualmachinescalesetnetworkconfiguration.go | 9 + ...scalesetnetworkconfigurationdnssettings.go | 8 + ...escalesetnetworkconfigurationproperties.go | 18 + ...el_virtualmachinescalesetnetworkprofile.go | 10 + .../model_virtualmachinescalesetosdisk.go | 18 + .../model_virtualmachinescalesetosprofile.go | 16 + .../model_virtualmachinescalesetproperties.go | 48 + ...inescalesetpublicipaddressconfiguration.go | 10 + ...publicipaddressconfigurationdnssettings.go | 9 + ...tpublicipaddressconfigurationproperties.go | 13 + ...virtualmachinescalesetreimageparameters.go | 12 + .../model_virtualmachinescalesetsku.go | 10 + ...model_virtualmachinescalesetskucapacity.go | 11 + ...el_virtualmachinescalesetstorageprofile.go | 11 + .../model_virtualmachinescalesetupdate.go | 18 + ...ualmachinescalesetupdateipconfiguration.go | 9 + ...scalesetupdateipconfigurationproperties.go | 15 + ...chinescalesetupdatenetworkconfiguration.go | 9 + ...setupdatenetworkconfigurationproperties.go | 18 + ...tualmachinescalesetupdatenetworkprofile.go | 10 + ...odel_virtualmachinescalesetupdateosdisk.go | 15 + ...l_virtualmachinescalesetupdateosprofile.go | 11 + ..._virtualmachinescalesetupdateproperties.go | 21 + ...lesetupdatepublicipaddressconfiguration.go | 9 + ...epublicipaddressconfigurationproperties.go | 11 + ...tualmachinescalesetupdatestorageprofile.go | 11 + ...l_virtualmachinescalesetupdatevmprofile.go | 19 + ...rtualmachinescalesetvmextensionssummary.go | 9 + ...del_virtualmachinescalesetvminstanceids.go | 8 + ...ualmachinescalesetvminstancerequiredids.go | 8 + .../model_virtualmachinescalesetvmprofile.go | 43 + .../model_virtualmachinestatuscodecount.go | 9 + .../model_vmdisksecurityprofile.go | 9 + .../model_vmgalleryapplication.go | 13 + ...lesetconverttosingleplacementgroupinput.go | 8 + .../model_vmsizeproperties.go | 9 + .../model_windowsconfiguration.go | 14 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_winrmconfiguration.go | 8 + .../model_winrmlistener.go | 9 + .../virtualmachinescalesets/predicates.go | 68 + .../virtualmachinescalesets/version.go | 10 + .../README.md | 98 + .../client.go | 26 + .../constants.go | 54 + .../id_virtualmachineextension.go | 148 + .../id_virtualmachineextension_test.go | 372 +++ ...id_virtualmachinescalesetvirtualmachine.go | 139 + ...rtualmachinescalesetvirtualmachine_test.go | 327 ++ .../method_createorupdate.go | 75 + .../method_delete.go | 71 + .../method_get.go | 83 + .../method_list.go | 83 + .../method_update.go | 74 + .../model_instanceviewstatus.go | 30 + .../model_keyvaultsecretreference.go | 9 + .../model_subresource.go | 8 + ...del_virtualmachineextensioninstanceview.go | 12 + ...model_virtualmachineextensionproperties.go | 20 + ...virtualmachineextensionupdateproperties.go | 17 + ...model_virtualmachinescalesetvmextension.go | 12 + ...almachinescalesetvmextensionslistresult.go | 8 + ...virtualmachinescalesetvmextensionupdate.go | 11 + .../version.go | 10 + .../README.md | 99 + .../client.go | 26 + .../constants.go | 110 + ...id_virtualmachinescalesetvirtualmachine.go | 139 + ...rtualmachinescalesetvirtualmachine_test.go | 327 ++ ...machinescalesetvirtualmachineruncommand.go | 148 + ...nescalesetvirtualmachineruncommand_test.go | 372 +++ .../method_createorupdate.go | 75 + .../method_delete.go | 71 + .../method_get.go | 83 + .../method_list.go | 134 + .../method_update.go | 74 + .../model_instanceviewstatus.go | 30 + .../model_runcommandinputparameter.go | 9 + .../model_runcommandmanagedidentity.go | 9 + .../model_virtualmachineruncommand.go | 13 + ...el_virtualmachineruncommandinstanceview.go | 45 + ...odel_virtualmachineruncommandproperties.go | 21 + ...el_virtualmachineruncommandscriptsource.go | 11 + .../model_virtualmachineruncommandupdate.go | 9 + .../predicates.go | 32 + .../version.go | 10 + .../virtualmachinescalesetvms/README.md | 277 ++ .../virtualmachinescalesetvms/client.go | 26 + .../virtualmachinescalesetvms/constants.go | 2176 ++++++++++++++ .../id_virtualmachinescaleset.go | 130 + .../id_virtualmachinescaleset_test.go | 282 ++ ...id_virtualmachinescalesetvirtualmachine.go | 139 + ...rtualmachinescalesetvirtualmachine_test.go | 327 ++ .../method_approverollingupgrade.go | 69 + .../method_attachdetachdatadisks.go | 75 + .../method_deallocate.go | 70 + .../method_delete.go | 100 + .../virtualmachinescalesetvms/method_get.go | 83 + .../method_getinstanceview.go | 54 + .../virtualmachinescalesetvms/method_list.go | 142 + .../method_performmaintenance.go | 70 + .../method_poweroff.go | 99 + .../method_redeploy.go | 70 + .../method_reimage.go | 74 + .../method_reimageall.go | 70 + .../method_restart.go | 70 + .../method_retrievebootdiagnosticsdata.go | 83 + .../method_runcommand.go | 75 + .../method_simulateeviction.go | 47 + .../virtualmachinescalesetvms/method_start.go | 70 + .../method_update.go | 108 + .../model_additionalcapabilities.go | 9 + .../model_additionalunattendcontent.go | 11 + .../model_apientityreference.go | 8 + .../model_attachdetachdatadisksrequest.go | 9 + .../model_bootdiagnostics.go | 9 + .../model_bootdiagnosticsinstanceview.go | 10 + .../model_datadisk.go | 22 + .../model_datadiskstoattach.go | 13 + .../model_datadiskstodetach.go | 9 + .../model_diagnosticsprofile.go | 8 + .../model_diffdisksettings.go | 9 + .../model_diskencryptionsettings.go | 10 + .../model_diskinstanceview.go | 10 + .../model_encryptionidentity.go | 8 + .../model_hardwareprofile.go | 9 + .../model_hostendpointsettings.go | 9 + .../model_imagereference.go | 15 + .../model_instanceviewstatus.go | 30 + .../model_keyvaultkeyreference.go | 9 + .../model_keyvaultsecretreference.go | 9 + .../model_linuxconfiguration.go | 12 + .../model_linuxpatchsettings.go | 10 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_maintenanceredeploystatus.go | 68 + .../model_manageddiskparameters.go | 11 + .../model_networkinterfacereference.go | 9 + ...del_networkinterfacereferenceproperties.go | 9 + .../model_networkprofile.go | 10 + .../virtualmachinescalesetvms/model_osdisk.go | 19 + .../model_osprofile.go | 16 + .../model_osprofileprovisioningdata.go | 9 + .../model_patchsettings.go | 11 + .../virtualmachinescalesetvms/model_plan.go | 11 + .../model_proxyagentsettings.go | 12 + .../model_publicipaddresssku.go | 9 + ...model_retrievebootdiagnosticsdataresult.go | 9 + .../model_runcommandinput.go | 10 + .../model_runcommandinputparameter.go | 9 + .../model_runcommandresult.go | 8 + .../model_securityprofile.go | 12 + .../virtualmachinescalesetvms/model_sku.go | 10 + .../model_sshconfiguration.go | 8 + .../model_sshpublickey.go | 9 + .../model_storageprofile.go | 12 + .../model_subresource.go | 8 + .../model_uefisettings.go | 9 + .../model_vaultcertificate.go | 9 + .../model_vaultsecretgroup.go | 9 + .../model_virtualharddisk.go | 8 + .../model_virtualmachineagentinstanceview.go | 10 + .../model_virtualmachineextension.go | 13 + ...tualmachineextensionhandlerinstanceview.go | 10 + ...del_virtualmachineextensioninstanceview.go | 12 + ...model_virtualmachineextensionproperties.go | 20 + .../model_virtualmachinehealthstatus.go | 8 + .../model_virtualmachineiptag.go | 9 + ...ualmachinenetworkinterfaceconfiguration.go | 9 + ...networkinterfaceconfigurationproperties.go | 19 + ...etworkinterfacednssettingsconfiguration.go | 8 + ...lmachinenetworkinterfaceipconfiguration.go | 9 + ...tworkinterfaceipconfigurationproperties.go | 14 + ...tualmachinepublicipaddressconfiguration.go | 10 + ...epublicipaddressconfigurationproperties.go | 14 + ...publicipaddressdnssettingsconfiguration.go | 9 + ...l_virtualmachinescalesetipconfiguration.go | 9 + ...achinescalesetipconfigurationproperties.go | 15 + .../model_virtualmachinescalesetiptag.go | 9 + ...tualmachinescalesetnetworkconfiguration.go | 9 + ...scalesetnetworkconfigurationdnssettings.go | 8 + ...escalesetnetworkconfigurationproperties.go | 18 + ...inescalesetpublicipaddressconfiguration.go | 10 + ...publicipaddressconfigurationdnssettings.go | 9 + ...tpublicipaddressconfigurationproperties.go | 13 + .../model_virtualmachinescalesetvm.go | 25 + ...el_virtualmachinescalesetvminstanceview.go | 23 + ...nescalesetvmnetworkprofileconfiguration.go | 8 + ...odel_virtualmachinescalesetvmproperties.go | 44 + ...irtualmachinescalesetvmprotectionpolicy.go | 9 + ...rtualmachinescalesetvmreimageparameters.go | 11 + .../model_vmdisksecurityprofile.go | 9 + .../model_vmsizeproperties.go | 9 + .../model_windowsconfiguration.go | 14 + ...vmguestpatchautomaticbyplatformsettings.go | 9 + .../model_winrmconfiguration.go | 8 + .../model_winrmlistener.go | 9 + .../virtualmachinescalesetvms/predicates.go | 42 + .../virtualmachinescalesetvms/version.go | 10 + .../2024-11-01/virtualmachinesizes/README.md | 36 + .../2024-11-01/virtualmachinesizes/client.go | 26 + .../virtualmachinesizes/id_location.go | 121 + .../virtualmachinesizes/id_location_test.go | 237 ++ .../virtualmachinesizes/method_list.go | 54 + .../model_virtualmachinesize.go | 13 + .../model_virtualmachinesizelistresult.go | 8 + .../2024-11-01/virtualmachinesizes/version.go | 10 + .../model_hivelinkedservicetypeproperties.go | 69 +- .../model_sparklinkedservicetypeproperties.go | 57 +- .../model_hivelinkedservicetypeproperties.go | 69 +- .../model_sparklinkedservicetypeproperties.go | 57 +- ...dbalancerhealthperruleperbackendaddress.go | 8 +- .../constants.go | 6 - .../constants.go | 6 - .../2025-04-01/accesstoken/README.md | 62 + .../2025-04-01/accesstoken/client.go | 26 + .../2025-04-01/accesstoken/constants.go | 95 + .../2025-04-01/accesstoken/id_account.go | 130 + .../2025-04-01/accesstoken/id_account_test.go | 282 ++ .../accesstoken/method_generateaccesstoken.go | 58 + ...hod_generaterestrictedvieweraccesstoken.go | 58 + .../accesstoken/model_accesstoken.go | 8 + .../model_generateaccesstokenparameters.go | 11 + ...terestrictedvieweraccesstokenparameters.go | 10 + .../2025-04-01/accesstoken/version.go | 10 + .../2025-04-01/accounts/README.md | 129 + .../2025-04-01/accounts/client.go | 26 + .../2025-04-01/accounts/constants.go | 195 ++ .../2025-04-01/accounts/id_account.go | 130 + .../2025-04-01/accounts/id_account_test.go | 282 ++ .../accounts/method_createorupdate.go | 58 + .../2025-04-01/accounts/method_delete.go | 48 + .../2025-04-01/accounts/method_get.go | 53 + .../2025-04-01/accounts/method_list.go | 106 + .../accounts/method_listbyresourcegroup.go | 106 + .../2025-04-01/accounts/method_update.go | 57 + .../2025-04-01/accounts/model_account.go | 20 + .../2025-04-01/accounts/model_accountpatch.go | 14 + .../model_accountpropertiesforpatchrequest.go | 14 + .../model_accountpropertiesforputrequest.go | 17 + .../model_openaiservicesforpatchrequest.go | 9 + .../model_openaiservicesforputrequest.go | 9 + .../accounts/model_privateendpoint.go | 8 + .../model_privateendpointconnection.go | 16 + ...del_privateendpointconnectionproperties.go | 11 + ...model_privatelinkserviceconnectionstate.go | 10 + .../model_storageservicesforpatchrequest.go | 8 + .../model_storageservicesforputrequest.go | 9 + .../2025-04-01/accounts/predicates.go | 32 + .../2025-04-01/accounts/version.go | 10 + .../videoindexer/2025-04-01/arc/README.md | 62 + .../videoindexer/2025-04-01/arc/client.go | 26 + .../videoindexer/2025-04-01/arc/constants.go | 95 + .../videoindexer/2025-04-01/arc/id_account.go | 130 + .../2025-04-01/arc/id_account_test.go | 282 ++ .../method_generateextensionaccesstoken.go | 58 + ...ateextensionrestrictedvieweraccesstoken.go | 58 + .../2025-04-01/arc/model_accesstoken.go | 8 + ..._generateextensionaccesstokenparameters.go | 12 + ...onrestrictedvieweraccesstokenparameters.go | 11 + .../videoindexer/2025-04-01/arc/version.go | 10 + .../videoindexer/2025-04-01/client.go | 73 + .../2025-04-01/nameavailability/README.md | 42 + .../2025-04-01/nameavailability/client.go | 26 + .../2025-04-01/nameavailability/constants.go | 86 + .../method_accountschecknameavailability.go | 59 + ..._accountchecknameavailabilityparameters.go | 9 + .../model_checknameavailabilityresult.go | 10 + .../2025-04-01/nameavailability/version.go | 10 + .../privateendpointconnections/README.md | 82 + .../privateendpointconnections/client.go | 26 + .../privateendpointconnections/constants.go | 101 + .../privateendpointconnections/id_account.go | 130 + .../id_account_test.go | 282 ++ .../id_privateendpointconnection.go | 139 + .../id_privateendpointconnection_test.go | 327 ++ .../method_createorupdate.go | 75 + .../method_delete.go | 70 + .../privateendpointconnections/method_get.go | 53 + .../method_listbyaccount.go | 105 + .../model_privateendpoint.go | 8 + .../model_privateendpointconnection.go | 16 + ...del_privateendpointconnectionproperties.go | 11 + ...model_privatelinkserviceconnectionstate.go | 10 + .../privateendpointconnections/predicates.go | 27 + .../privateendpointconnections/version.go | 10 + .../2025-04-01/privatelinkresources/README.md | 53 + .../2025-04-01/privatelinkresources/client.go | 26 + .../privatelinkresources/id_account.go | 130 + .../privatelinkresources/id_account_test.go | 282 ++ .../id_privatelinkresource.go | 139 + .../id_privatelinkresource_test.go | 327 ++ .../privatelinkresources/method_get.go | 53 + .../method_listbyaccount.go | 105 + .../model_privatelinkresource.go | 16 + .../model_privatelinkresourceproperties.go | 10 + .../privatelinkresources/predicates.go | 27 + .../privatelinkresources/version.go | 10 + 1024 files changed, 63188 insertions(+), 136 deletions(-) create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/README.md create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/client.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/constants.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_converttovirtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_get.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_list.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_listavailablesizes.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_listbysubscription.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_update.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_availabilityset.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetproperties.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetupdate.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_converttovirtualmachinescalesetinput.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_eventgridandresourcegraph.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventspolicy.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedreboot.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedredeploy.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesize.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesizelistresult.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/predicates.go create mode 100644 resource-manager/compute/2024-11-01/availabilitysets/version.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/README.md create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/client.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/constants.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup_test.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/method_listbycapacityreservationgroup.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservation.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationproperties.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationutilization.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/model_subresourcereadonly.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/predicates.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservation/version.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/README.md create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/client.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/constants.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup_test.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/method_get.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbyresourcegroup.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbysubscription.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/method_update.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroup.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupproperties.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupupdate.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationutilization.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_resourcesharingprofile.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresourcereadonly.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/predicates.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservationgroups/version.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/README.md create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/client.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/constants.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation_test.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/method_get.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/method_update.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservation.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationproperties.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationupdate.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationutilization.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/model_subresourcereadonly.go create mode 100644 resource-manager/compute/2024-11-01/capacityreservations/version.go create mode 100644 resource-manager/compute/2024-11-01/client.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/README.md create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/client.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/constants.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/method_listavailablesizes.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/method_listbyhostgroup.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/method_redeploy.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/method_restart.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhost.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostallocatablevm.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostavailablecapacity.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostproperties.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostsizelistresult.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/model_subresourcereadonly.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/predicates.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhost/version.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/README.md create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/client.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/constants.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/method_get.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbyresourcegroup.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbysubscription.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/method_update.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/model_subresourcereadonly.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/predicates.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhostgroups/version.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/README.md create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/client.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/constants.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/method_get.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/method_update.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhost.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostproperties.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostupdate.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/model_subresourcereadonly.go create mode 100644 resource-manager/compute/2024-11-01/dedicatedhosts/version.go create mode 100644 resource-manager/compute/2024-11-01/images/README.md create mode 100644 resource-manager/compute/2024-11-01/images/client.go create mode 100644 resource-manager/compute/2024-11-01/images/constants.go create mode 100644 resource-manager/compute/2024-11-01/images/id_image.go create mode 100644 resource-manager/compute/2024-11-01/images/id_image_test.go create mode 100644 resource-manager/compute/2024-11-01/images/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/images/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/images/method_get.go create mode 100644 resource-manager/compute/2024-11-01/images/method_list.go create mode 100644 resource-manager/compute/2024-11-01/images/method_listbyresourcegroup.go create mode 100644 resource-manager/compute/2024-11-01/images/method_update.go create mode 100644 resource-manager/compute/2024-11-01/images/model_image.go create mode 100644 resource-manager/compute/2024-11-01/images/model_imagedatadisk.go create mode 100644 resource-manager/compute/2024-11-01/images/model_imageosdisk.go create mode 100644 resource-manager/compute/2024-11-01/images/model_imageproperties.go create mode 100644 resource-manager/compute/2024-11-01/images/model_imagestorageprofile.go create mode 100644 resource-manager/compute/2024-11-01/images/model_imageupdate.go create mode 100644 resource-manager/compute/2024-11-01/images/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/images/predicates.go create mode 100644 resource-manager/compute/2024-11-01/images/version.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/README.md create mode 100644 resource-manager/compute/2024-11-01/loganalytics/client.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/constants.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/id_location.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/id_location_test.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/method_exportrequestratebyinterval.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/method_exportthrottledrequests.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsinputbase.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoperationresult.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoutput.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/model_requestratebyintervalinput.go create mode 100644 resource-manager/compute/2024-11-01/loganalytics/version.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/README.md create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/client.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/constants.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup_test.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/method_get.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbyresourcegroup.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbysubscription.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/method_update.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroup.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/model_updateresource.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/predicates.go create mode 100644 resource-manager/compute/2024-11-01/proximityplacementgroups/version.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/README.md create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/client.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/constants.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection_test.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/method_get.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/method_list.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/method_listall.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/method_update.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_additionalunattendcontent.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_apientityreference.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_bootdiagnostics.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_diagnosticsprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_diskencryptionsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointattributes.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointreplicationstatus.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_encryptionidentity.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_hardwareprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_hostendpointsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultkeyreference.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_linuxconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_linuxpatchsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_manageddiskparameters.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_osprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_patchsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_proxyagentsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepoint.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollection.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionproperties.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionsourceproperties.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionupdate.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointencryption.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointproperties.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcemetadata.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmdatadisk.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmosdisk.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_securityprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_sshconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_sshpublickey.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_uefisettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_vaultcertificate.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_vaultsecretgroup.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_vmdisksecurityprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_vmsizeproperties.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_windowsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_winrmconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/model_winrmlistener.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/predicates.go create mode 100644 resource-manager/compute/2024-11-01/restorepointcollections/version.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/README.md create mode 100644 resource-manager/compute/2024-11-01/restorepoints/client.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/constants.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/id_restorepoint.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/id_restorepoint_test.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/method_create.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/method_get.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_additionalunattendcontent.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_apientityreference.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_bootdiagnostics.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_diagnosticsprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_diskencryptionsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointattributes.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointreplicationstatus.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_encryptionidentity.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_hardwareprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_hostendpointsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_keyvaultkeyreference.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_linuxconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_linuxpatchsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_manageddiskparameters.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_osprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_patchsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_proxyagentsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepoint.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointencryption.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointproperties.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcemetadata.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmdatadisk.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmosdisk.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmstorageprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_securityprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_sshconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_sshpublickey.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_uefisettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_vaultcertificate.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_vaultsecretgroup.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_vmdisksecurityprofile.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_vmsizeproperties.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_windowsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_winrmconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/model_winrmlistener.go create mode 100644 resource-manager/compute/2024-11-01/restorepoints/version.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/README.md create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/client.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/constants.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey_test.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_create.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_generatekeypair.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_get.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_listbyresourcegroup.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_listbysubscription.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/method_update.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/model_sshgeneratekeypairinputparameters.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresource.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyupdateresource.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/predicates.go create mode 100644 resource-manager/compute/2024-11-01/sshpublickeys/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listtypes.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listversions.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimageproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensionimages/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineextensions/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_location.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_location_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_offer.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_offer_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_sku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_sku_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezoneget.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelist.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistoffers.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistpublishers.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistskus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_listbyedgezone.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_listoffers.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_listpublishers.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/method_listskus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_alternativeoption.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_automaticosupgradeproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_datadiskimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_disallowedconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_imagedeprecationstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_osdiskimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_purchaseplan.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimagefeature.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineimages/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_getbyvirtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_listbyvirtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocument.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocumentbase.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandinputparameter.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandmanagedidentity.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandparameterdefinition.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachineruncommands/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/id_location.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/id_location_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_assesspatches.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_attachdetachdatadisks.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_capture.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_converttomanageddisks.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_deallocate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_generalize.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_installpatches.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_instanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_listall.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_listavailablesizes.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_listbylocation.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_migratetovmscaleset.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_performmaintenance.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_poweroff.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_reapply.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_redeploy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_reimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_restart.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_retrievebootdiagnosticsdata.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_runcommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_simulateeviction.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_start.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_additionalcapabilities.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_additionalunattendcontent.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_apientityreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_apierror.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_apierrorbase.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_applicationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_attachdetachdatadisksrequest.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_availablepatchsummary.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_billingprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnostics.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnosticsinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_capacityreservationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_datadisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstoattach.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstodetach.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_diagnosticsprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_diffdisksettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_diskencryptionsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_diskinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_encryptionidentity.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_eventgridandresourcegraph.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_hardwareprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_hostendpointsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_imagereference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_innererror.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultkeyreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_lastpatchinstallationsummary.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_linuxconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_linuxparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_linuxpatchsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_maintenanceredeploystatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_manageddiskparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereferenceproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_networkprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_osdisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_osimagenotificationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_osprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_osprofileprovisioningdata.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_patchinstallationdetail.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_patchsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_placement.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_plan.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_proxyagentsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_publicipaddresssku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinput.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinputparameter.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_runcommandresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventspolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_securityprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_sshconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_sshpublickey.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_storageprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_terminatenotificationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_uefisettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedreboot.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedredeploy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_vaultcertificate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_vaultsecretgroup.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualharddisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineagentinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineassesspatchesresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensioninstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinehealthstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineiptag.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepatchstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinereimageparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesize.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesizelistresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_vmdisksecurityprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_vmgalleryapplication.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_vmsizeproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_windowsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_windowsparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_winrmconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/model_winrmlistener.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachines/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_cancel.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_getlatest.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startextensionupgrade.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startosupgrade.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierror.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierrorbase.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_innererror.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradepolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradeprogressinfo.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgraderunningstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfo.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfoproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_approverollingupgrade.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_converttosingleplacementgroup.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_deallocate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_deleteinstances.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getosupgradehistory.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listall.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listbylocation.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listskus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_performmaintenance.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_poweroff.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reapply.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_redeploy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimageall.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_restart.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_setorchestrationservicestate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_start.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/method_updateinstances.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalcapabilities.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalunattendcontent.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apientityreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierror.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierrorbase.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_applicationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticosupgradepolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticrepairspolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_billingprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_bootdiagnostics.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_capacityreservationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diagnosticsprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diffdisksettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_encryptionidentity.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_eventgridandresourcegraph.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_hostendpointsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_imagereference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_innererror.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxpatchsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicestateinput.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicesummary.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osimagenotificationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osprofileprovisioningdata.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_patchsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_plan.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_prioritymixpolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_proxyagentsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_publicipaddresssku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_recoverywalkresponse.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resiliencypolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollbackstatusinfo.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradepolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scaleinpolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventspolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereferenceupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_serviceartifactreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofilevmsize.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_spotrestorepolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshpublickey.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_terminatenotificationprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_uefisettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradepolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedreboot.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedredeploy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultcertificate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultsecretgroup.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualharddisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmdisksecurityprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmgalleryapplication.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmsizeproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmlistener.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesets/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_createorupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/constants.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_approverollingupgrade.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_deallocate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_delete.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_get.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_getinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_performmaintenance.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_poweroff.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_redeploy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimage.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimageall.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_restart.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_runcommand.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_simulateeviction.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_start.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_update.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalcapabilities.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalunattendcontent.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_apientityreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnostics.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstoattach.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstodetach.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diagnosticsprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diffdisksettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskencryptionsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_encryptionidentity.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hardwareprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hostendpointsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_imagereference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_instanceviewstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxpatchsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_manageddiskparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereference.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osdisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_patchsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_plan.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_proxyagentsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_publicipaddresssku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinput.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinputparameter.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_securityprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sku.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshpublickey.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_storageprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_subresource.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_uefisettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultcertificate.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultsecretgroup.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualharddisk.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextension.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineiptag.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmsizeproperties.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmconfiguration.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmlistener.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/predicates.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinescalesetvms/version.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/README.md create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/client.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/id_location.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/id_location_test.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/method_list.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesize.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesizelistresult.go create mode 100644 resource-manager/compute/2024-11-01/virtualmachinesizes/version.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/README.md create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/constants.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/id_account.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/id_account_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/method_generateaccesstoken.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/method_generaterestrictedvieweraccesstoken.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/model_accesstoken.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/model_generateaccesstokenparameters.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/model_generaterestrictedvieweraccesstokenparameters.go create mode 100644 resource-manager/videoindexer/2025-04-01/accesstoken/version.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/README.md create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/constants.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/id_account.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/id_account_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/method_createorupdate.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/method_delete.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/method_get.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/method_list.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/method_listbyresourcegroup.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/method_update.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_account.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_accountpatch.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforpatchrequest.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforputrequest.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforpatchrequest.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforputrequest.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_privateendpoint.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnection.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnectionproperties.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_privatelinkserviceconnectionstate.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforpatchrequest.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforputrequest.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/predicates.go create mode 100644 resource-manager/videoindexer/2025-04-01/accounts/version.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/README.md create mode 100644 resource-manager/videoindexer/2025-04-01/arc/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/constants.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/id_account.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/id_account_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/method_generateextensionaccesstoken.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/method_generateextensionrestrictedvieweraccesstoken.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/model_accesstoken.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/model_generateextensionaccesstokenparameters.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/model_generateextensionrestrictedvieweraccesstokenparameters.go create mode 100644 resource-manager/videoindexer/2025-04-01/arc/version.go create mode 100644 resource-manager/videoindexer/2025-04-01/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/README.md create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/constants.go create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/method_accountschecknameavailability.go create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/model_accountchecknameavailabilityparameters.go create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/model_checknameavailabilityresult.go create mode 100644 resource-manager/videoindexer/2025-04-01/nameavailability/version.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/README.md create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/constants.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_createorupdate.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_delete.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_get.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_listbyaccount.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpoint.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnection.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnectionproperties.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/predicates.go create mode 100644 resource-manager/videoindexer/2025-04-01/privateendpointconnections/version.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/README.md create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/client.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource_test.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/method_get.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/method_listbyaccount.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresource.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresourceproperties.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/predicates.go create mode 100644 resource-manager/videoindexer/2025-04-01/privatelinkresources/version.go diff --git a/resource-manager/compute/2024-11-01/availabilitysets/README.md b/resource-manager/compute/2024-11-01/availabilitysets/README.md new file mode 100644 index 00000000000..8bea2d61eee --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/README.md @@ -0,0 +1,220 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/availabilitysets` Documentation + +The `availabilitysets` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/availabilitysets" +``` + + +### Client Initialization + +```go +client := availabilitysets.NewAvailabilitySetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AvailabilitySetsClient.CancelMigrationToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +read, err := client.CancelMigrationToVirtualMachineScaleSet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.ConvertToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.ConvertToVirtualMachineScaleSetInput{ + // ... +} + + +if err := client.ConvertToVirtualMachineScaleSetThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AvailabilitySetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.AvailabilitySet{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +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: `AvailabilitySetsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// 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: `AvailabilitySetsClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +read, err := client.ListAvailableSizes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, availabilitysets.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AvailabilitySetsClient.StartMigrationToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.MigrateToVirtualMachineScaleSetInput{ + // ... +} + + +read, err := client.StartMigrationToVirtualMachineScaleSet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.AvailabilitySetUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AvailabilitySetsClient.ValidateMigrationToVirtualMachineScaleSet` + +```go +ctx := context.TODO() +id := commonids.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetName") + +payload := availabilitysets.MigrateToVirtualMachineScaleSetInput{ + // ... +} + + +read, err := client.ValidateMigrationToVirtualMachineScaleSet(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/availabilitysets/client.go b/resource-manager/compute/2024-11-01/availabilitysets/client.go new file mode 100644 index 00000000000..8bc85925a49 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/client.go @@ -0,0 +1,26 @@ +package availabilitysets + +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 AvailabilitySetsClient struct { + Client *resourcemanager.Client +} + +func NewAvailabilitySetsClientWithBaseURI(sdkApi sdkEnv.Api) (*AvailabilitySetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "availabilitysets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AvailabilitySetsClient: %+v", err) + } + + return &AvailabilitySetsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/constants.go b/resource-manager/compute/2024-11-01/availabilitysets/constants.go new file mode 100644 index 00000000000..4ddc7488363 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/constants.go @@ -0,0 +1,54 @@ +package availabilitysets + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go b/resource-manager/compute/2024-11-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go new file mode 100644 index 00000000000..b3597b0c4c6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_cancelmigrationtovirtualmachinescaleset.go @@ -0,0 +1,48 @@ +package availabilitysets + +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 CancelMigrationToVirtualMachineScaleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// CancelMigrationToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) CancelMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId) (result CancelMigrationToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/cancelMigrationToVirtualMachineScaleSet", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_converttovirtualmachinescaleset.go b/resource-manager/compute/2024-11-01/availabilitysets/method_converttovirtualmachinescaleset.go new file mode 100644 index 00000000000..51549e21578 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_converttovirtualmachinescaleset.go @@ -0,0 +1,74 @@ +package availabilitysets + +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/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 ConvertToVirtualMachineScaleSetOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConvertToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) ConvertToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId, input ConvertToVirtualMachineScaleSetInput) (result ConvertToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/convertToVirtualMachineScaleSet", 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 +} + +// ConvertToVirtualMachineScaleSetThenPoll performs ConvertToVirtualMachineScaleSet then polls until it's completed +func (c AvailabilitySetsClient) ConvertToVirtualMachineScaleSetThenPoll(ctx context.Context, id commonids.AvailabilitySetId, input ConvertToVirtualMachineScaleSetInput) error { + result, err := c.ConvertToVirtualMachineScaleSet(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ConvertToVirtualMachineScaleSet: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConvertToVirtualMachineScaleSet: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_createorupdate.go b/resource-manager/compute/2024-11-01/availabilitysets/method_createorupdate.go new file mode 100644 index 00000000000..0fd3b44fe2c --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_createorupdate.go @@ -0,0 +1,58 @@ +package availabilitysets + +import ( + "context" + "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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// CreateOrUpdate ... +func (c AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, id commonids.AvailabilitySetId, input AvailabilitySet) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model AvailabilitySet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_delete.go b/resource-manager/compute/2024-11-01/availabilitysets/method_delete.go new file mode 100644 index 00000000000..e89779e3039 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_delete.go @@ -0,0 +1,48 @@ +package availabilitysets + +import ( + "context" + "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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c AvailabilitySetsClient) Delete(ctx context.Context, id commonids.AvailabilitySetId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_get.go b/resource-manager/compute/2024-11-01/availabilitysets/method_get.go new file mode 100644 index 00000000000..5331c2457d7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_get.go @@ -0,0 +1,54 @@ +package availabilitysets + +import ( + "context" + "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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// Get ... +func (c AvailabilitySetsClient) Get(ctx context.Context, id commonids.AvailabilitySetId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model AvailabilitySet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_list.go b/resource-manager/compute/2024-11-01/availabilitysets/method_list.go new file mode 100644 index 00000000000..f5a12a32b9e --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_list.go @@ -0,0 +1,106 @@ +package availabilitysets + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AvailabilitySet +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []AvailabilitySet +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c AvailabilitySetsClient) List(ctx context.Context, id commonids.ResourceGroupId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/availabilitySets", 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 *[]AvailabilitySet `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 AvailabilitySetsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AvailabilitySetOperationPredicate) (result ListCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_listavailablesizes.go b/resource-manager/compute/2024-11-01/availabilitysets/method_listavailablesizes.go new file mode 100644 index 00000000000..d47e9dec5a7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_listavailablesizes.go @@ -0,0 +1,55 @@ +package availabilitysets + +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 ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineSizeListResult +} + +// ListAvailableSizes ... +func (c AvailabilitySetsClient) ListAvailableSizes(ctx context.Context, id commonids.AvailabilitySetId) (result ListAvailableSizesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/vmSizes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineSizeListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_listbysubscription.go b/resource-manager/compute/2024-11-01/availabilitysets/method_listbysubscription.go new file mode 100644 index 00000000000..44f1ba6844b --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_listbysubscription.go @@ -0,0 +1,135 @@ +package availabilitysets + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AvailabilitySet +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []AvailabilitySet +} + +type ListBySubscriptionOperationOptions struct { + Expand *string +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c AvailabilitySetsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/availabilitySets", 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 *[]AvailabilitySet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c AvailabilitySetsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, AvailabilitySetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate AvailabilitySetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + resp, err := c.ListBySubscription(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go b/resource-manager/compute/2024-11-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go new file mode 100644 index 00000000000..321194795c6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_startmigrationtovirtualmachinescaleset.go @@ -0,0 +1,52 @@ +package availabilitysets + +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 StartMigrationToVirtualMachineScaleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// StartMigrationToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) StartMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId, input MigrateToVirtualMachineScaleSetInput) (result StartMigrationToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/startMigrationToVirtualMachineScaleSet", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_update.go b/resource-manager/compute/2024-11-01/availabilitysets/method_update.go new file mode 100644 index 00000000000..8eb2093ecd2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_update.go @@ -0,0 +1,58 @@ +package availabilitysets + +import ( + "context" + "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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AvailabilitySet +} + +// Update ... +func (c AvailabilitySetsClient) Update(ctx context.Context, id commonids.AvailabilitySetId, input AvailabilitySetUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model AvailabilitySet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go b/resource-manager/compute/2024-11-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go new file mode 100644 index 00000000000..e21fce7027c --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/method_validatemigrationtovirtualmachinescaleset.go @@ -0,0 +1,52 @@ +package availabilitysets + +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 ValidateMigrationToVirtualMachineScaleSetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ValidateMigrationToVirtualMachineScaleSet ... +func (c AvailabilitySetsClient) ValidateMigrationToVirtualMachineScaleSet(ctx context.Context, id commonids.AvailabilitySetId, input MigrateToVirtualMachineScaleSetInput) (result ValidateMigrationToVirtualMachineScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/validateMigrationToVirtualMachineScaleSet", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_availabilityset.go b/resource-manager/compute/2024-11-01/availabilitysets/model_availabilityset.go new file mode 100644 index 00000000000..49248ed2f4a --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_availabilityset.go @@ -0,0 +1,14 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySet struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetproperties.go b/resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetproperties.go new file mode 100644 index 00000000000..4cca9bf01c9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetproperties.go @@ -0,0 +1,14 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetProperties struct { + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + PlatformUpdateDomainCount *int64 `json:"platformUpdateDomainCount,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VirtualMachineScaleSetMigrationInfo *VirtualMachineScaleSetMigrationInfo `json:"virtualMachineScaleSetMigrationInfo,omitempty"` + VirtualMachines *[]SubResource `json:"virtualMachines,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetupdate.go b/resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetupdate.go new file mode 100644 index 00000000000..04ce035cd46 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_availabilitysetupdate.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetUpdate struct { + Properties *AvailabilitySetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_converttovirtualmachinescalesetinput.go b/resource-manager/compute/2024-11-01/availabilitysets/model_converttovirtualmachinescalesetinput.go new file mode 100644 index 00000000000..6ac9107691d --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_converttovirtualmachinescalesetinput.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ConvertToVirtualMachineScaleSetInput struct { + VirtualMachineScaleSetName *string `json:"virtualMachineScaleSetName,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go b/resource-manager/compute/2024-11-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go new file mode 100644 index 00000000000..08f3416fc48 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_defaultvirtualmachinescalesetinfo.go @@ -0,0 +1,9 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DefaultVirtualMachineScaleSetInfo struct { + ConstrainedMaximumCapacity *bool `json:"constrainedMaximumCapacity,omitempty"` + DefaultVirtualMachineScaleSet *SubResource `json:"defaultVirtualMachineScaleSet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_eventgridandresourcegraph.go b/resource-manager/compute/2024-11-01/availabilitysets/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..4a30c74c8a0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_eventgridandresourcegraph.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/availabilitysets/model_instanceviewstatus.go new file mode 100644 index 00000000000..038a3c1dd32 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package availabilitysets + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go b/resource-manager/compute/2024-11-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go new file mode 100644 index 00000000000..18f5c9adb62 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_migratetovirtualmachinescalesetinput.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateToVirtualMachineScaleSetInput struct { + VirtualMachineScaleSetFlexible SubResource `json:"virtualMachineScaleSetFlexible"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..b59b4ed3a89 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventspolicy.go b/resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..3763ce0d4af --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_scheduledeventspolicy.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_sku.go b/resource-manager/compute/2024-11-01/availabilitysets/model_sku.go new file mode 100644 index 00000000000..9e275b34b2a --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_sku.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_subresource.go b/resource-manager/compute/2024-11-01/availabilitysets/model_subresource.go new file mode 100644 index 00000000000..9890abb18c9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_subresource.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedreboot.go b/resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedreboot.go new file mode 100644 index 00000000000..29506a0c958 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedredeploy.go b/resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..a84f4fb1b66 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go b/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go new file mode 100644 index 00000000000..930ca8a508f --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinescalesetmigrationinfo.go @@ -0,0 +1,9 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetMigrationInfo struct { + DefaultVirtualMachineScaleSetInfo *DefaultVirtualMachineScaleSetInfo `json:"defaultVirtualMachineScaleSetInfo,omitempty"` + MigrateToVirtualMachineScaleSet *SubResource `json:"migrateToVirtualMachineScaleSet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesize.go b/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesize.go new file mode 100644 index 00000000000..d9b2adc3758 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesizelistresult.go b/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesizelistresult.go new file mode 100644 index 00000000000..190cfb1b670 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/model_virtualmachinesizelistresult.go @@ -0,0 +1,8 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSizeListResult struct { + Value *[]VirtualMachineSize `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/availabilitysets/predicates.go b/resource-manager/compute/2024-11-01/availabilitysets/predicates.go new file mode 100644 index 00000000000..bb3e2b2b319 --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/predicates.go @@ -0,0 +1,32 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AvailabilitySetOperationPredicate) Matches(input AvailabilitySet) 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/compute/2024-11-01/availabilitysets/version.go b/resource-manager/compute/2024-11-01/availabilitysets/version.go new file mode 100644 index 00000000000..d30aefb38cf --- /dev/null +++ b/resource-manager/compute/2024-11-01/availabilitysets/version.go @@ -0,0 +1,10 @@ +package availabilitysets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/availabilitysets/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/README.md b/resource-manager/compute/2024-11-01/capacityreservation/README.md new file mode 100644 index 00000000000..6574e4a034e --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/README.md @@ -0,0 +1,37 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservation` Documentation + +The `capacityreservation` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/capacityreservation" +``` + + +### Client Initialization + +```go +client := capacityreservation.NewCapacityReservationClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityReservationClient.ListByCapacityReservationGroup` + +```go +ctx := context.TODO() +id := capacityreservation.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +// alternatively `client.ListByCapacityReservationGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByCapacityReservationGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/compute/2024-11-01/capacityreservation/client.go b/resource-manager/compute/2024-11-01/capacityreservation/client.go new file mode 100644 index 00000000000..8387846bbe8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/client.go @@ -0,0 +1,26 @@ +package capacityreservation + +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 CapacityReservationClient struct { + Client *resourcemanager.Client +} + +func NewCapacityReservationClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityReservationClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "capacityreservation", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapacityReservationClient: %+v", err) + } + + return &CapacityReservationClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/constants.go b/resource-manager/compute/2024-11-01/capacityreservation/constants.go new file mode 100644 index 00000000000..92f4676834a --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/constants.go @@ -0,0 +1,54 @@ +package capacityreservation + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup.go b/resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup.go new file mode 100644 index 00000000000..36f9098c509 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup.go @@ -0,0 +1,130 @@ +package capacityreservation + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CapacityReservationGroupId{}) +} + +var _ resourceids.ResourceId = &CapacityReservationGroupId{} + +// CapacityReservationGroupId is a struct representing the Resource ID for a Capacity Reservation Group +type CapacityReservationGroupId struct { + SubscriptionId string + ResourceGroupName string + CapacityReservationGroupName string +} + +// NewCapacityReservationGroupID returns a new CapacityReservationGroupId struct +func NewCapacityReservationGroupID(subscriptionId string, resourceGroupName string, capacityReservationGroupName string) CapacityReservationGroupId { + return CapacityReservationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityReservationGroupName: capacityReservationGroupName, + } +} + +// ParseCapacityReservationGroupID parses 'input' into a CapacityReservationGroupId +func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapacityReservationGroupIDInsensitively parses 'input' case-insensitively into a CapacityReservationGroupId +// note: this method should only be used for API response data and not user input +func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationGroupId) 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.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) + } + + return nil +} + +// ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID +func ValidateCapacityReservationGroupID(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 := ParseCapacityReservationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Reservation Group ID +func (id CapacityReservationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/capacityReservationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityReservationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Reservation Group ID +func (id CapacityReservationGroupId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticCapacityReservationGroups", "capacityReservationGroups", "capacityReservationGroups"), + resourceids.UserSpecifiedSegment("capacityReservationGroupName", "capacityReservationGroupName"), + } +} + +// String returns a human-readable description of this Capacity Reservation Group ID +func (id CapacityReservationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Capacity Reservation Group Name: %q", id.CapacityReservationGroupName), + } + return fmt.Sprintf("Capacity Reservation Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup_test.go b/resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup_test.go new file mode 100644 index 00000000000..a5f7f7a0d6a --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/id_capacityreservationgroup_test.go @@ -0,0 +1,282 @@ +package capacityreservation + +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 = &CapacityReservationGroupId{} + +func TestNewCapacityReservationGroupID(t *testing.T) { + id := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + + 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.CapacityReservationGroupName != "capacityReservationGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationGroupName'", id.CapacityReservationGroupName, "capacityReservationGroupName") + } +} + +func TestFormatCapacityReservationGroupID(t *testing.T) { + actual := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCapacityReservationGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestParseCapacityReservationGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CapacityReservationGroupName: "cApAcItYrEsErVaTiOnGrOuPnAmE", + }, + }, + { + // 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.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestSegmentsForCapacityReservationGroupId(t *testing.T) { + segments := CapacityReservationGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CapacityReservationGroupId 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/compute/2024-11-01/capacityreservation/method_listbycapacityreservationgroup.go b/resource-manager/compute/2024-11-01/capacityreservation/method_listbycapacityreservationgroup.go new file mode 100644 index 00000000000..2f8db2b36b9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/method_listbycapacityreservationgroup.go @@ -0,0 +1,105 @@ +package capacityreservation + +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 ListByCapacityReservationGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CapacityReservation +} + +type ListByCapacityReservationGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapacityReservation +} + +type ListByCapacityReservationGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByCapacityReservationGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByCapacityReservationGroup ... +func (c CapacityReservationClient) ListByCapacityReservationGroup(ctx context.Context, id CapacityReservationGroupId) (result ListByCapacityReservationGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByCapacityReservationGroupCustomPager{}, + Path: fmt.Sprintf("%s/capacityReservations", 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 *[]CapacityReservation `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByCapacityReservationGroupComplete retrieves all the results into a single object +func (c CapacityReservationClient) ListByCapacityReservationGroupComplete(ctx context.Context, id CapacityReservationGroupId) (ListByCapacityReservationGroupCompleteResult, error) { + return c.ListByCapacityReservationGroupCompleteMatchingPredicate(ctx, id, CapacityReservationOperationPredicate{}) +} + +// ListByCapacityReservationGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapacityReservationClient) ListByCapacityReservationGroupCompleteMatchingPredicate(ctx context.Context, id CapacityReservationGroupId, predicate CapacityReservationOperationPredicate) (result ListByCapacityReservationGroupCompleteResult, err error) { + items := make([]CapacityReservation, 0) + + resp, err := c.ListByCapacityReservationGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByCapacityReservationGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservation.go b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservation.go new file mode 100644 index 00000000000..24331ec3ced --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservation.go @@ -0,0 +1,19 @@ +package capacityreservation + +import ( + "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 CapacityReservation struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CapacityReservationProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationinstanceview.go b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationinstanceview.go new file mode 100644 index 00000000000..efc0c0ed798 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationinstanceview.go @@ -0,0 +1,9 @@ +package capacityreservation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationInstanceView struct { + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationproperties.go b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationproperties.go new file mode 100644 index 00000000000..af9795ad4b9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationproperties.go @@ -0,0 +1,44 @@ +package capacityreservation + +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 CapacityReservationProperties struct { + InstanceView *CapacityReservationInstanceView `json:"instanceView,omitempty"` + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + ReservationId *string `json:"reservationId,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachinesAssociated *[]SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty"` +} + +func (o *CapacityReservationProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CapacityReservationProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *CapacityReservationProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *CapacityReservationProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationutilization.go b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationutilization.go new file mode 100644 index 00000000000..5c0297d028e --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_capacityreservationutilization.go @@ -0,0 +1,9 @@ +package capacityreservation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUtilization struct { + CurrentCapacity *int64 `json:"currentCapacity,omitempty"` + VirtualMachinesAllocated *[]SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/capacityreservation/model_instanceviewstatus.go new file mode 100644 index 00000000000..75202a2e7f6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package capacityreservation + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_sku.go b/resource-manager/compute/2024-11-01/capacityreservation/model_sku.go new file mode 100644 index 00000000000..a88eaf14cd7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_sku.go @@ -0,0 +1,10 @@ +package capacityreservation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/model_subresourcereadonly.go b/resource-manager/compute/2024-11-01/capacityreservation/model_subresourcereadonly.go new file mode 100644 index 00000000000..b0b388beedd --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package capacityreservation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservation/predicates.go b/resource-manager/compute/2024-11-01/capacityreservation/predicates.go new file mode 100644 index 00000000000..b8a1f7fb332 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/predicates.go @@ -0,0 +1,32 @@ +package capacityreservation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CapacityReservationOperationPredicate) Matches(input CapacityReservation) 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/compute/2024-11-01/capacityreservation/version.go b/resource-manager/compute/2024-11-01/capacityreservation/version.go new file mode 100644 index 00000000000..bf51eb7514e --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservation/version.go @@ -0,0 +1,10 @@ +package capacityreservation + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/capacityreservation/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/README.md b/resource-manager/compute/2024-11-01/capacityreservationgroups/README.md new file mode 100644 index 00000000000..233309ddb40 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservationgroups` Documentation + +The `capacityreservationgroups` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservationgroups" +``` + + +### Client Initialization + +```go +client := capacityreservationgroups.NewCapacityReservationGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityReservationGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +payload := capacityreservationgroups.CapacityReservationGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.Delete` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.Get` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +read, err := client.Get(ctx, id, capacityreservationgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id, capacityreservationgroups.DefaultListByResourceGroupOperationOptions())` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id, capacityreservationgroups.DefaultListByResourceGroupOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id, capacityreservationgroups.DefaultListBySubscriptionOperationOptions())` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id, capacityreservationgroups.DefaultListBySubscriptionOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CapacityReservationGroupsClient.Update` + +```go +ctx := context.TODO() +id := capacityreservationgroups.NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + +payload := capacityreservationgroups.CapacityReservationGroupUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/client.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/client.go new file mode 100644 index 00000000000..088a08cf103 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/client.go @@ -0,0 +1,26 @@ +package capacityreservationgroups + +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 CapacityReservationGroupsClient struct { + Client *resourcemanager.Client +} + +func NewCapacityReservationGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityReservationGroupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "capacityreservationgroups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapacityReservationGroupsClient: %+v", err) + } + + return &CapacityReservationGroupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/constants.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/constants.go new file mode 100644 index 00000000000..febfc3b3c97 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/constants.go @@ -0,0 +1,177 @@ +package capacityreservationgroups + +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 CapacityReservationGroupInstanceViewTypes string + +const ( + CapacityReservationGroupInstanceViewTypesInstanceView CapacityReservationGroupInstanceViewTypes = "instanceView" +) + +func PossibleValuesForCapacityReservationGroupInstanceViewTypes() []string { + return []string{ + string(CapacityReservationGroupInstanceViewTypesInstanceView), + } +} + +func (s *CapacityReservationGroupInstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCapacityReservationGroupInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCapacityReservationGroupInstanceViewTypes(input string) (*CapacityReservationGroupInstanceViewTypes, error) { + vals := map[string]CapacityReservationGroupInstanceViewTypes{ + "instanceview": CapacityReservationGroupInstanceViewTypesInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CapacityReservationGroupInstanceViewTypes(input) + return &out, nil +} + +type ExpandTypesForGetCapacityReservationGroups string + +const ( + ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef ExpandTypesForGetCapacityReservationGroups = "virtualMachineScaleSetVMs/$ref" + ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef ExpandTypesForGetCapacityReservationGroups = "virtualMachines/$ref" +) + +func PossibleValuesForExpandTypesForGetCapacityReservationGroups() []string { + return []string{ + string(ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef), + string(ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef), + } +} + +func (s *ExpandTypesForGetCapacityReservationGroups) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypesForGetCapacityReservationGroups(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypesForGetCapacityReservationGroups(input string) (*ExpandTypesForGetCapacityReservationGroups, error) { + vals := map[string]ExpandTypesForGetCapacityReservationGroups{ + "virtualmachinescalesetvms/$ref": ExpandTypesForGetCapacityReservationGroupsVirtualMachineScaleSetVMsRef, + "virtualmachines/$ref": ExpandTypesForGetCapacityReservationGroupsVirtualMachinesRef, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypesForGetCapacityReservationGroups(input) + return &out, nil +} + +type ResourceIdOptionsForGetCapacityReservationGroups string + +const ( + ResourceIdOptionsForGetCapacityReservationGroupsAll ResourceIdOptionsForGetCapacityReservationGroups = "All" + ResourceIdOptionsForGetCapacityReservationGroupsCreatedInSubscription ResourceIdOptionsForGetCapacityReservationGroups = "CreatedInSubscription" + ResourceIdOptionsForGetCapacityReservationGroupsSharedWithSubscription ResourceIdOptionsForGetCapacityReservationGroups = "SharedWithSubscription" +) + +func PossibleValuesForResourceIdOptionsForGetCapacityReservationGroups() []string { + return []string{ + string(ResourceIdOptionsForGetCapacityReservationGroupsAll), + string(ResourceIdOptionsForGetCapacityReservationGroupsCreatedInSubscription), + string(ResourceIdOptionsForGetCapacityReservationGroupsSharedWithSubscription), + } +} + +func (s *ResourceIdOptionsForGetCapacityReservationGroups) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResourceIdOptionsForGetCapacityReservationGroups(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResourceIdOptionsForGetCapacityReservationGroups(input string) (*ResourceIdOptionsForGetCapacityReservationGroups, error) { + vals := map[string]ResourceIdOptionsForGetCapacityReservationGroups{ + "all": ResourceIdOptionsForGetCapacityReservationGroupsAll, + "createdinsubscription": ResourceIdOptionsForGetCapacityReservationGroupsCreatedInSubscription, + "sharedwithsubscription": ResourceIdOptionsForGetCapacityReservationGroupsSharedWithSubscription, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResourceIdOptionsForGetCapacityReservationGroups(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup.go new file mode 100644 index 00000000000..edd8c309cf2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup.go @@ -0,0 +1,130 @@ +package capacityreservationgroups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CapacityReservationGroupId{}) +} + +var _ resourceids.ResourceId = &CapacityReservationGroupId{} + +// CapacityReservationGroupId is a struct representing the Resource ID for a Capacity Reservation Group +type CapacityReservationGroupId struct { + SubscriptionId string + ResourceGroupName string + CapacityReservationGroupName string +} + +// NewCapacityReservationGroupID returns a new CapacityReservationGroupId struct +func NewCapacityReservationGroupID(subscriptionId string, resourceGroupName string, capacityReservationGroupName string) CapacityReservationGroupId { + return CapacityReservationGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityReservationGroupName: capacityReservationGroupName, + } +} + +// ParseCapacityReservationGroupID parses 'input' into a CapacityReservationGroupId +func ParseCapacityReservationGroupID(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapacityReservationGroupIDInsensitively parses 'input' case-insensitively into a CapacityReservationGroupId +// note: this method should only be used for API response data and not user input +func ParseCapacityReservationGroupIDInsensitively(input string) (*CapacityReservationGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationGroupId) 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.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) + } + + return nil +} + +// ValidateCapacityReservationGroupID checks that 'input' can be parsed as a Capacity Reservation Group ID +func ValidateCapacityReservationGroupID(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 := ParseCapacityReservationGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Reservation Group ID +func (id CapacityReservationGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/capacityReservationGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityReservationGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Reservation Group ID +func (id CapacityReservationGroupId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticCapacityReservationGroups", "capacityReservationGroups", "capacityReservationGroups"), + resourceids.UserSpecifiedSegment("capacityReservationGroupName", "capacityReservationGroupName"), + } +} + +// String returns a human-readable description of this Capacity Reservation Group ID +func (id CapacityReservationGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Capacity Reservation Group Name: %q", id.CapacityReservationGroupName), + } + return fmt.Sprintf("Capacity Reservation Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup_test.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup_test.go new file mode 100644 index 00000000000..aac88ae1e0b --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/id_capacityreservationgroup_test.go @@ -0,0 +1,282 @@ +package capacityreservationgroups + +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 = &CapacityReservationGroupId{} + +func TestNewCapacityReservationGroupID(t *testing.T) { + id := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName") + + 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.CapacityReservationGroupName != "capacityReservationGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationGroupName'", id.CapacityReservationGroupName, "capacityReservationGroupName") + } +} + +func TestFormatCapacityReservationGroupID(t *testing.T) { + actual := NewCapacityReservationGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCapacityReservationGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestParseCapacityReservationGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationGroupId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE", + Expected: &CapacityReservationGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CapacityReservationGroupName: "cApAcItYrEsErVaTiOnGrOuPnAmE", + }, + }, + { + // 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.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + } +} + +func TestSegmentsForCapacityReservationGroupId(t *testing.T) { + segments := CapacityReservationGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CapacityReservationGroupId 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/compute/2024-11-01/capacityreservationgroups/method_createorupdate.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_createorupdate.go new file mode 100644 index 00000000000..b2779f3d9df --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_createorupdate.go @@ -0,0 +1,58 @@ +package capacityreservationgroups + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservationGroup +} + +// CreateOrUpdate ... +func (c CapacityReservationGroupsClient) CreateOrUpdate(ctx context.Context, id CapacityReservationGroupId, input CapacityReservationGroup) (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 + } + + var model CapacityReservationGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/method_delete.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_delete.go new file mode 100644 index 00000000000..2ae30c459f7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_delete.go @@ -0,0 +1,47 @@ +package capacityreservationgroups + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c CapacityReservationGroupsClient) Delete(ctx context.Context, id CapacityReservationGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/method_get.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_get.go new file mode 100644 index 00000000000..40ec743fa1e --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_get.go @@ -0,0 +1,83 @@ +package capacityreservationgroups + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservationGroup +} + +type GetOperationOptions struct { + Expand *CapacityReservationGroupInstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c CapacityReservationGroupsClient) Get(ctx context.Context, id CapacityReservationGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CapacityReservationGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbyresourcegroup.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbyresourcegroup.go new file mode 100644 index 00000000000..471bfa93e53 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbyresourcegroup.go @@ -0,0 +1,135 @@ +package capacityreservationgroups + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CapacityReservationGroup +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapacityReservationGroup +} + +type ListByResourceGroupOperationOptions struct { + Expand *ExpandTypesForGetCapacityReservationGroups +} + +func DefaultListByResourceGroupOperationOptions() ListByResourceGroupOperationOptions { + return ListByResourceGroupOperationOptions{} +} + +func (o ListByResourceGroupOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByResourceGroupOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByResourceGroupOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c CapacityReservationGroupsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/capacityReservationGroups", 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 *[]CapacityReservationGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c CapacityReservationGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, options, CapacityReservationGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapacityReservationGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListByResourceGroupOperationOptions, predicate CapacityReservationGroupOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CapacityReservationGroup, 0) + + resp, err := c.ListByResourceGroup(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbysubscription.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbysubscription.go new file mode 100644 index 00000000000..ef48698b737 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_listbysubscription.go @@ -0,0 +1,139 @@ +package capacityreservationgroups + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]CapacityReservationGroup +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []CapacityReservationGroup +} + +type ListBySubscriptionOperationOptions struct { + Expand *ExpandTypesForGetCapacityReservationGroups + ResourceIdsOnly *ResourceIdOptionsForGetCapacityReservationGroups +} + +func DefaultListBySubscriptionOperationOptions() ListBySubscriptionOperationOptions { + return ListBySubscriptionOperationOptions{} +} + +func (o ListBySubscriptionOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListBySubscriptionOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.ResourceIdsOnly != nil { + out.Append("resourceIdsOnly", fmt.Sprintf("%v", *o.ResourceIdsOnly)) + } + return &out +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c CapacityReservationGroupsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/capacityReservationGroups", 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 *[]CapacityReservationGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c CapacityReservationGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, options, CapacityReservationGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CapacityReservationGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListBySubscriptionOperationOptions, predicate CapacityReservationGroupOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CapacityReservationGroup, 0) + + resp, err := c.ListBySubscription(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/method_update.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_update.go new file mode 100644 index 00000000000..0ab0ca706c1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/method_update.go @@ -0,0 +1,57 @@ +package capacityreservationgroups + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservationGroup +} + +// Update ... +func (c CapacityReservationGroupsClient) Update(ctx context.Context, id CapacityReservationGroupId, input CapacityReservationGroupUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model CapacityReservationGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroup.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroup.go new file mode 100644 index 00000000000..2382573acf3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroup.go @@ -0,0 +1,18 @@ +package capacityreservationgroups + +import ( + "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 CapacityReservationGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go new file mode 100644 index 00000000000..1276e3654d0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupinstanceview.go @@ -0,0 +1,9 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupInstanceView struct { + CapacityReservations *[]CapacityReservationInstanceViewWithName `json:"capacityReservations,omitempty"` + SharedSubscriptionIds *[]SubResourceReadOnly `json:"sharedSubscriptionIds,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupproperties.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupproperties.go new file mode 100644 index 00000000000..cfcdae8f6f5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupproperties.go @@ -0,0 +1,11 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupProperties struct { + CapacityReservations *[]SubResourceReadOnly `json:"capacityReservations,omitempty"` + InstanceView *CapacityReservationGroupInstanceView `json:"instanceView,omitempty"` + SharingProfile *ResourceSharingProfile `json:"sharingProfile,omitempty"` + VirtualMachinesAssociated *[]SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupupdate.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupupdate.go new file mode 100644 index 00000000000..d1f847c4e8f --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationgroupupdate.go @@ -0,0 +1,9 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupUpdate struct { + Properties *CapacityReservationGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go new file mode 100644 index 00000000000..95a760be66a --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationinstanceviewwithname.go @@ -0,0 +1,10 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationInstanceViewWithName struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationutilization.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationutilization.go new file mode 100644 index 00000000000..453c4d0ea1f --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_capacityreservationutilization.go @@ -0,0 +1,9 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUtilization struct { + CurrentCapacity *int64 `json:"currentCapacity,omitempty"` + VirtualMachinesAllocated *[]SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..666443e0020 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package capacityreservationgroups + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_resourcesharingprofile.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_resourcesharingprofile.go new file mode 100644 index 00000000000..b50488d95b0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_resourcesharingprofile.go @@ -0,0 +1,8 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourceSharingProfile struct { + SubscriptionIds *[]SubResource `json:"subscriptionIds,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresource.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresource.go new file mode 100644 index 00000000000..c7c2e0ed790 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresource.go @@ -0,0 +1,8 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresourcereadonly.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresourcereadonly.go new file mode 100644 index 00000000000..4fc514b46ac --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservationgroups/predicates.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/predicates.go new file mode 100644 index 00000000000..d33edd6ae80 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/predicates.go @@ -0,0 +1,32 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CapacityReservationGroupOperationPredicate) Matches(input CapacityReservationGroup) 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/compute/2024-11-01/capacityreservationgroups/version.go b/resource-manager/compute/2024-11-01/capacityreservationgroups/version.go new file mode 100644 index 00000000000..529baf47fbd --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservationgroups/version.go @@ -0,0 +1,10 @@ +package capacityreservationgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/capacityreservationgroups/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/README.md b/resource-manager/compute/2024-11-01/capacityreservations/README.md new file mode 100644 index 00000000000..b793ea446c7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservations` Documentation + +The `capacityreservations` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/capacityreservations" +``` + + +### Client Initialization + +```go +client := capacityreservations.NewCapacityReservationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CapacityReservationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +payload := capacityreservations.CapacityReservation{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityReservationsClient.Delete` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CapacityReservationsClient.Get` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +read, err := client.Get(ctx, id, capacityreservations.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `CapacityReservationsClient.Update` + +```go +ctx := context.TODO() +id := capacityreservations.NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + +payload := capacityreservations.CapacityReservationUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/capacityreservations/client.go b/resource-manager/compute/2024-11-01/capacityreservations/client.go new file mode 100644 index 00000000000..46407a5fa33 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/client.go @@ -0,0 +1,26 @@ +package capacityreservations + +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 CapacityReservationsClient struct { + Client *resourcemanager.Client +} + +func NewCapacityReservationsClientWithBaseURI(sdkApi sdkEnv.Api) (*CapacityReservationsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "capacityreservations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CapacityReservationsClient: %+v", err) + } + + return &CapacityReservationsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/constants.go b/resource-manager/compute/2024-11-01/capacityreservations/constants.go new file mode 100644 index 00000000000..d8475a2ee90 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/constants.go @@ -0,0 +1,92 @@ +package capacityreservations + +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 CapacityReservationInstanceViewTypes string + +const ( + CapacityReservationInstanceViewTypesInstanceView CapacityReservationInstanceViewTypes = "instanceView" +) + +func PossibleValuesForCapacityReservationInstanceViewTypes() []string { + return []string{ + string(CapacityReservationInstanceViewTypesInstanceView), + } +} + +func (s *CapacityReservationInstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCapacityReservationInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCapacityReservationInstanceViewTypes(input string) (*CapacityReservationInstanceViewTypes, error) { + vals := map[string]CapacityReservationInstanceViewTypes{ + "instanceview": CapacityReservationInstanceViewTypesInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CapacityReservationInstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation.go b/resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation.go new file mode 100644 index 00000000000..fc4e90461a0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation.go @@ -0,0 +1,139 @@ +package capacityreservations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&CapacityReservationId{}) +} + +var _ resourceids.ResourceId = &CapacityReservationId{} + +// CapacityReservationId is a struct representing the Resource ID for a Capacity Reservation +type CapacityReservationId struct { + SubscriptionId string + ResourceGroupName string + CapacityReservationGroupName string + CapacityReservationName string +} + +// NewCapacityReservationID returns a new CapacityReservationId struct +func NewCapacityReservationID(subscriptionId string, resourceGroupName string, capacityReservationGroupName string, capacityReservationName string) CapacityReservationId { + return CapacityReservationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CapacityReservationGroupName: capacityReservationGroupName, + CapacityReservationName: capacityReservationName, + } +} + +// ParseCapacityReservationID parses 'input' into a CapacityReservationId +func ParseCapacityReservationID(input string) (*CapacityReservationId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCapacityReservationIDInsensitively parses 'input' case-insensitively into a CapacityReservationId +// note: this method should only be used for API response data and not user input +func ParseCapacityReservationIDInsensitively(input string) (*CapacityReservationId, error) { + parser := resourceids.NewParserFromResourceIdType(&CapacityReservationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CapacityReservationId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CapacityReservationId) 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.CapacityReservationGroupName, ok = input.Parsed["capacityReservationGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationGroupName", input) + } + + if id.CapacityReservationName, ok = input.Parsed["capacityReservationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "capacityReservationName", input) + } + + return nil +} + +// ValidateCapacityReservationID checks that 'input' can be parsed as a Capacity Reservation ID +func ValidateCapacityReservationID(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 := ParseCapacityReservationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Capacity Reservation ID +func (id CapacityReservationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/capacityReservationGroups/%s/capacityReservations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CapacityReservationGroupName, id.CapacityReservationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Capacity Reservation ID +func (id CapacityReservationId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticCapacityReservationGroups", "capacityReservationGroups", "capacityReservationGroups"), + resourceids.UserSpecifiedSegment("capacityReservationGroupName", "capacityReservationGroupName"), + resourceids.StaticSegment("staticCapacityReservations", "capacityReservations", "capacityReservations"), + resourceids.UserSpecifiedSegment("capacityReservationName", "capacityReservationName"), + } +} + +// String returns a human-readable description of this Capacity Reservation ID +func (id CapacityReservationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Capacity Reservation Group Name: %q", id.CapacityReservationGroupName), + fmt.Sprintf("Capacity Reservation Name: %q", id.CapacityReservationName), + } + return fmt.Sprintf("Capacity Reservation (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation_test.go b/resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation_test.go new file mode 100644 index 00000000000..f82b679396f --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/id_capacityreservation_test.go @@ -0,0 +1,327 @@ +package capacityreservations + +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 = &CapacityReservationId{} + +func TestNewCapacityReservationID(t *testing.T) { + id := NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName") + + 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.CapacityReservationGroupName != "capacityReservationGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationGroupName'", id.CapacityReservationGroupName, "capacityReservationGroupName") + } + + if id.CapacityReservationName != "capacityReservationName" { + t.Fatalf("Expected %q but got %q for Segment 'CapacityReservationName'", id.CapacityReservationName, "capacityReservationName") + } +} + +func TestFormatCapacityReservationID(t *testing.T) { + actual := NewCapacityReservationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "capacityReservationGroupName", "capacityReservationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseCapacityReservationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName", + Expected: &CapacityReservationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + CapacityReservationName: "capacityReservationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + if actual.CapacityReservationName != v.Expected.CapacityReservationName { + t.Fatalf("Expected %q but got %q for CapacityReservationName", v.Expected.CapacityReservationName, actual.CapacityReservationName) + } + + } +} + +func TestParseCapacityReservationIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CapacityReservationId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/cApAcItYrEsErVaTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName", + Expected: &CapacityReservationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + CapacityReservationGroupName: "capacityReservationGroupName", + CapacityReservationName: "capacityReservationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/capacityReservationGroups/capacityReservationGroupName/capacityReservations/capacityReservationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/cApAcItYrEsErVaTiOnS/cApAcItYrEsErVaTiOnNaMe", + Expected: &CapacityReservationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + CapacityReservationGroupName: "cApAcItYrEsErVaTiOnGrOuPnAmE", + CapacityReservationName: "cApAcItYrEsErVaTiOnNaMe", + }, + }, + { + // 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.cOmPuTe/cApAcItYrEsErVaTiOnGrOuPs/cApAcItYrEsErVaTiOnGrOuPnAmE/cApAcItYrEsErVaTiOnS/cApAcItYrEsErVaTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseCapacityReservationIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CapacityReservationGroupName != v.Expected.CapacityReservationGroupName { + t.Fatalf("Expected %q but got %q for CapacityReservationGroupName", v.Expected.CapacityReservationGroupName, actual.CapacityReservationGroupName) + } + + if actual.CapacityReservationName != v.Expected.CapacityReservationName { + t.Fatalf("Expected %q but got %q for CapacityReservationName", v.Expected.CapacityReservationName, actual.CapacityReservationName) + } + + } +} + +func TestSegmentsForCapacityReservationId(t *testing.T) { + segments := CapacityReservationId{}.Segments() + if len(segments) == 0 { + t.Fatalf("CapacityReservationId 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/compute/2024-11-01/capacityreservations/method_createorupdate.go b/resource-manager/compute/2024-11-01/capacityreservations/method_createorupdate.go new file mode 100644 index 00000000000..4cc71a324c2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/method_createorupdate.go @@ -0,0 +1,75 @@ +package capacityreservations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservation +} + +// CreateOrUpdate ... +func (c CapacityReservationsClient) CreateOrUpdate(ctx context.Context, id CapacityReservationId, input CapacityReservation) (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 CapacityReservationsClient) CreateOrUpdateThenPoll(ctx context.Context, id CapacityReservationId, input CapacityReservation) 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/compute/2024-11-01/capacityreservations/method_delete.go b/resource-manager/compute/2024-11-01/capacityreservations/method_delete.go new file mode 100644 index 00000000000..7f0da68dfea --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/method_delete.go @@ -0,0 +1,71 @@ +package capacityreservations + +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 CapacityReservationsClient) Delete(ctx context.Context, id CapacityReservationId) (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 CapacityReservationsClient) DeleteThenPoll(ctx context.Context, id CapacityReservationId) 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/compute/2024-11-01/capacityreservations/method_get.go b/resource-manager/compute/2024-11-01/capacityreservations/method_get.go new file mode 100644 index 00000000000..b9d6e655ff4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/method_get.go @@ -0,0 +1,83 @@ +package capacityreservations + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservation +} + +type GetOperationOptions struct { + Expand *CapacityReservationInstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c CapacityReservationsClient) Get(ctx context.Context, id CapacityReservationId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model CapacityReservation + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/method_update.go b/resource-manager/compute/2024-11-01/capacityreservations/method_update.go new file mode 100644 index 00000000000..40dc175553a --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/method_update.go @@ -0,0 +1,75 @@ +package capacityreservations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *CapacityReservation +} + +// Update ... +func (c CapacityReservationsClient) Update(ctx context.Context, id CapacityReservationId, input CapacityReservationUpdate) (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 CapacityReservationsClient) UpdateThenPoll(ctx context.Context, id CapacityReservationId, input CapacityReservationUpdate) 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/compute/2024-11-01/capacityreservations/model_capacityreservation.go b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservation.go new file mode 100644 index 00000000000..7afddad9271 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservation.go @@ -0,0 +1,19 @@ +package capacityreservations + +import ( + "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 CapacityReservation struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CapacityReservationProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationinstanceview.go b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationinstanceview.go new file mode 100644 index 00000000000..e8f63035da7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationinstanceview.go @@ -0,0 +1,9 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationInstanceView struct { + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + UtilizationInfo *CapacityReservationUtilization `json:"utilizationInfo,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationproperties.go b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationproperties.go new file mode 100644 index 00000000000..6da0859e05c --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationproperties.go @@ -0,0 +1,44 @@ +package capacityreservations + +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 CapacityReservationProperties struct { + InstanceView *CapacityReservationInstanceView `json:"instanceView,omitempty"` + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + ReservationId *string `json:"reservationId,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachinesAssociated *[]SubResourceReadOnly `json:"virtualMachinesAssociated,omitempty"` +} + +func (o *CapacityReservationProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *CapacityReservationProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *CapacityReservationProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *CapacityReservationProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationupdate.go b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationupdate.go new file mode 100644 index 00000000000..0da9bad6a4d --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationupdate.go @@ -0,0 +1,10 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUpdate struct { + Properties *CapacityReservationProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationutilization.go b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationutilization.go new file mode 100644 index 00000000000..5e0a10e4ffa --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_capacityreservationutilization.go @@ -0,0 +1,9 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationUtilization struct { + CurrentCapacity *int64 `json:"currentCapacity,omitempty"` + VirtualMachinesAllocated *[]SubResourceReadOnly `json:"virtualMachinesAllocated,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/capacityreservations/model_instanceviewstatus.go new file mode 100644 index 00000000000..6ba65f8c44f --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package capacityreservations + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_sku.go b/resource-manager/compute/2024-11-01/capacityreservations/model_sku.go new file mode 100644 index 00000000000..21a19282ce3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_sku.go @@ -0,0 +1,10 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/model_subresourcereadonly.go b/resource-manager/compute/2024-11-01/capacityreservations/model_subresourcereadonly.go new file mode 100644 index 00000000000..7d380adbea1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/capacityreservations/version.go b/resource-manager/compute/2024-11-01/capacityreservations/version.go new file mode 100644 index 00000000000..535ca49fcb5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/capacityreservations/version.go @@ -0,0 +1,10 @@ +package capacityreservations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/capacityreservations/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/client.go b/resource-manager/compute/2024-11-01/client.go new file mode 100644 index 00000000000..e26827acbef --- /dev/null +++ b/resource-manager/compute/2024-11-01/client.go @@ -0,0 +1,244 @@ +package v2024_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/compute/2024-11-01/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservation" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservationgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/capacityreservations" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhost" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhostgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhosts" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/images" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/loganalytics" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/proximityplacementgroups" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/restorepointcollections" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/restorepoints" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/sshpublickeys" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineextensionimages" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineimages" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineruncommands" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachines" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesets" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetvms" + "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinesizes" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AvailabilitySets *availabilitysets.AvailabilitySetsClient + CapacityReservation *capacityreservation.CapacityReservationClient + CapacityReservationGroups *capacityreservationgroups.CapacityReservationGroupsClient + CapacityReservations *capacityreservations.CapacityReservationsClient + DedicatedHost *dedicatedhost.DedicatedHostClient + DedicatedHostGroups *dedicatedhostgroups.DedicatedHostGroupsClient + DedicatedHosts *dedicatedhosts.DedicatedHostsClient + Images *images.ImagesClient + LogAnalytics *loganalytics.LogAnalyticsClient + ProximityPlacementGroups *proximityplacementgroups.ProximityPlacementGroupsClient + RestorePointCollections *restorepointcollections.RestorePointCollectionsClient + RestorePoints *restorepoints.RestorePointsClient + SshPublicKeys *sshpublickeys.SshPublicKeysClient + VirtualMachineExtensionImages *virtualmachineextensionimages.VirtualMachineExtensionImagesClient + VirtualMachineExtensions *virtualmachineextensions.VirtualMachineExtensionsClient + VirtualMachineImages *virtualmachineimages.VirtualMachineImagesClient + VirtualMachineRunCommands *virtualmachineruncommands.VirtualMachineRunCommandsClient + VirtualMachineScaleSetExtensions *virtualmachinescalesetextensions.VirtualMachineScaleSetExtensionsClient + VirtualMachineScaleSetRollingUpgrades *virtualmachinescalesetrollingupgrades.VirtualMachineScaleSetRollingUpgradesClient + VirtualMachineScaleSetVMExtensions *virtualmachinescalesetvmextensions.VirtualMachineScaleSetVMExtensionsClient + VirtualMachineScaleSetVMRunCommands *virtualmachinescalesetvmruncommands.VirtualMachineScaleSetVMRunCommandsClient + VirtualMachineScaleSetVMs *virtualmachinescalesetvms.VirtualMachineScaleSetVMsClient + VirtualMachineScaleSets *virtualmachinescalesets.VirtualMachineScaleSetsClient + VirtualMachineSizes *virtualmachinesizes.VirtualMachineSizesClient + VirtualMachines *virtualmachines.VirtualMachinesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + availabilitySetsClient, err := availabilitysets.NewAvailabilitySetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AvailabilitySets client: %+v", err) + } + configureFunc(availabilitySetsClient.Client) + + capacityReservationClient, err := capacityreservation.NewCapacityReservationClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CapacityReservation client: %+v", err) + } + configureFunc(capacityReservationClient.Client) + + capacityReservationGroupsClient, err := capacityreservationgroups.NewCapacityReservationGroupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CapacityReservationGroups client: %+v", err) + } + configureFunc(capacityReservationGroupsClient.Client) + + capacityReservationsClient, err := capacityreservations.NewCapacityReservationsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building CapacityReservations client: %+v", err) + } + configureFunc(capacityReservationsClient.Client) + + dedicatedHostClient, err := dedicatedhost.NewDedicatedHostClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DedicatedHost client: %+v", err) + } + configureFunc(dedicatedHostClient.Client) + + dedicatedHostGroupsClient, err := dedicatedhostgroups.NewDedicatedHostGroupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DedicatedHostGroups client: %+v", err) + } + configureFunc(dedicatedHostGroupsClient.Client) + + dedicatedHostsClient, err := dedicatedhosts.NewDedicatedHostsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building DedicatedHosts client: %+v", err) + } + configureFunc(dedicatedHostsClient.Client) + + imagesClient, err := images.NewImagesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Images client: %+v", err) + } + configureFunc(imagesClient.Client) + + logAnalyticsClient, err := loganalytics.NewLogAnalyticsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building LogAnalytics client: %+v", err) + } + configureFunc(logAnalyticsClient.Client) + + proximityPlacementGroupsClient, err := proximityplacementgroups.NewProximityPlacementGroupsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building ProximityPlacementGroups client: %+v", err) + } + configureFunc(proximityPlacementGroupsClient.Client) + + restorePointCollectionsClient, err := restorepointcollections.NewRestorePointCollectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RestorePointCollections client: %+v", err) + } + configureFunc(restorePointCollectionsClient.Client) + + restorePointsClient, err := restorepoints.NewRestorePointsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building RestorePoints client: %+v", err) + } + configureFunc(restorePointsClient.Client) + + sshPublicKeysClient, err := sshpublickeys.NewSshPublicKeysClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building SshPublicKeys client: %+v", err) + } + configureFunc(sshPublicKeysClient.Client) + + virtualMachineExtensionImagesClient, err := virtualmachineextensionimages.NewVirtualMachineExtensionImagesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineExtensionImages client: %+v", err) + } + configureFunc(virtualMachineExtensionImagesClient.Client) + + virtualMachineExtensionsClient, err := virtualmachineextensions.NewVirtualMachineExtensionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineExtensions client: %+v", err) + } + configureFunc(virtualMachineExtensionsClient.Client) + + virtualMachineImagesClient, err := virtualmachineimages.NewVirtualMachineImagesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineImages client: %+v", err) + } + configureFunc(virtualMachineImagesClient.Client) + + virtualMachineRunCommandsClient, err := virtualmachineruncommands.NewVirtualMachineRunCommandsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineRunCommands client: %+v", err) + } + configureFunc(virtualMachineRunCommandsClient.Client) + + virtualMachineScaleSetExtensionsClient, err := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetExtensions client: %+v", err) + } + configureFunc(virtualMachineScaleSetExtensionsClient.Client) + + virtualMachineScaleSetRollingUpgradesClient, err := virtualmachinescalesetrollingupgrades.NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetRollingUpgrades client: %+v", err) + } + configureFunc(virtualMachineScaleSetRollingUpgradesClient.Client) + + virtualMachineScaleSetVMExtensionsClient, err := virtualmachinescalesetvmextensions.NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetVMExtensions client: %+v", err) + } + configureFunc(virtualMachineScaleSetVMExtensionsClient.Client) + + virtualMachineScaleSetVMRunCommandsClient, err := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVMRunCommandsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetVMRunCommands client: %+v", err) + } + configureFunc(virtualMachineScaleSetVMRunCommandsClient.Client) + + virtualMachineScaleSetVMsClient, err := virtualmachinescalesetvms.NewVirtualMachineScaleSetVMsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSetVMs client: %+v", err) + } + configureFunc(virtualMachineScaleSetVMsClient.Client) + + virtualMachineScaleSetsClient, err := virtualmachinescalesets.NewVirtualMachineScaleSetsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineScaleSets client: %+v", err) + } + configureFunc(virtualMachineScaleSetsClient.Client) + + virtualMachineSizesClient, err := virtualmachinesizes.NewVirtualMachineSizesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineSizes client: %+v", err) + } + configureFunc(virtualMachineSizesClient.Client) + + virtualMachinesClient, err := virtualmachines.NewVirtualMachinesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachines client: %+v", err) + } + configureFunc(virtualMachinesClient.Client) + + return &Client{ + AvailabilitySets: availabilitySetsClient, + CapacityReservation: capacityReservationClient, + CapacityReservationGroups: capacityReservationGroupsClient, + CapacityReservations: capacityReservationsClient, + DedicatedHost: dedicatedHostClient, + DedicatedHostGroups: dedicatedHostGroupsClient, + DedicatedHosts: dedicatedHostsClient, + Images: imagesClient, + LogAnalytics: logAnalyticsClient, + ProximityPlacementGroups: proximityPlacementGroupsClient, + RestorePointCollections: restorePointCollectionsClient, + RestorePoints: restorePointsClient, + SshPublicKeys: sshPublicKeysClient, + VirtualMachineExtensionImages: virtualMachineExtensionImagesClient, + VirtualMachineExtensions: virtualMachineExtensionsClient, + VirtualMachineImages: virtualMachineImagesClient, + VirtualMachineRunCommands: virtualMachineRunCommandsClient, + VirtualMachineScaleSetExtensions: virtualMachineScaleSetExtensionsClient, + VirtualMachineScaleSetRollingUpgrades: virtualMachineScaleSetRollingUpgradesClient, + VirtualMachineScaleSetVMExtensions: virtualMachineScaleSetVMExtensionsClient, + VirtualMachineScaleSetVMRunCommands: virtualMachineScaleSetVMRunCommandsClient, + VirtualMachineScaleSetVMs: virtualMachineScaleSetVMsClient, + VirtualMachineScaleSets: virtualMachineScaleSetsClient, + VirtualMachineSizes: virtualMachineSizesClient, + VirtualMachines: virtualMachinesClient, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/README.md b/resource-manager/compute/2024-11-01/dedicatedhost/README.md new file mode 100644 index 00000000000..16115814412 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/README.md @@ -0,0 +1,78 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhost` Documentation + +The `dedicatedhost` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhost" +``` + + +### Client Initialization + +```go +client := dedicatedhost.NewDedicatedHostClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +read, err := client.ListAvailableSizes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostClient.ListByHostGroup` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +// alternatively `client.ListByHostGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByHostGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostClient.Redeploy` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostClient.Restart` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/client.go b/resource-manager/compute/2024-11-01/dedicatedhost/client.go new file mode 100644 index 00000000000..5c78f75da1d --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/client.go @@ -0,0 +1,26 @@ +package dedicatedhost + +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 DedicatedHostClient struct { + Client *resourcemanager.Client +} + +func NewDedicatedHostClientWithBaseURI(sdkApi sdkEnv.Api) (*DedicatedHostClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dedicatedhost", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DedicatedHostClient: %+v", err) + } + + return &DedicatedHostClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/constants.go b/resource-manager/compute/2024-11-01/dedicatedhost/constants.go new file mode 100644 index 00000000000..023b3d3f159 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/constants.go @@ -0,0 +1,98 @@ +package dedicatedhost + +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 DedicatedHostLicenseTypes string + +const ( + DedicatedHostLicenseTypesNone DedicatedHostLicenseTypes = "None" + DedicatedHostLicenseTypesWindowsServerHybrid DedicatedHostLicenseTypes = "Windows_Server_Hybrid" + DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual" +) + +func PossibleValuesForDedicatedHostLicenseTypes() []string { + return []string{ + string(DedicatedHostLicenseTypesNone), + string(DedicatedHostLicenseTypesWindowsServerHybrid), + string(DedicatedHostLicenseTypesWindowsServerPerpetual), + } +} + +func (s *DedicatedHostLicenseTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDedicatedHostLicenseTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDedicatedHostLicenseTypes(input string) (*DedicatedHostLicenseTypes, error) { + vals := map[string]DedicatedHostLicenseTypes{ + "none": DedicatedHostLicenseTypesNone, + "windows_server_hybrid": DedicatedHostLicenseTypesWindowsServerHybrid, + "windows_server_perpetual": DedicatedHostLicenseTypesWindowsServerPerpetual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DedicatedHostLicenseTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/method_listavailablesizes.go b/resource-manager/compute/2024-11-01/dedicatedhost/method_listavailablesizes.go new file mode 100644 index 00000000000..b18a354564c --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/method_listavailablesizes.go @@ -0,0 +1,55 @@ +package dedicatedhost + +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 ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostSizeListResult +} + +// ListAvailableSizes ... +func (c DedicatedHostClient) ListAvailableSizes(ctx context.Context, id commonids.DedicatedHostId) (result ListAvailableSizesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/hostSizes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DedicatedHostSizeListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/method_listbyhostgroup.go b/resource-manager/compute/2024-11-01/dedicatedhost/method_listbyhostgroup.go new file mode 100644 index 00000000000..c4637f0a0c1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/method_listbyhostgroup.go @@ -0,0 +1,106 @@ +package dedicatedhost + +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 ListByHostGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DedicatedHost +} + +type ListByHostGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []DedicatedHost +} + +type ListByHostGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByHostGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByHostGroup ... +func (c DedicatedHostClient) ListByHostGroup(ctx context.Context, id commonids.DedicatedHostGroupId) (result ListByHostGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByHostGroupCustomPager{}, + Path: fmt.Sprintf("%s/hosts", 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 *[]DedicatedHost `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByHostGroupComplete retrieves all the results into a single object +func (c DedicatedHostClient) ListByHostGroupComplete(ctx context.Context, id commonids.DedicatedHostGroupId) (ListByHostGroupCompleteResult, error) { + return c.ListByHostGroupCompleteMatchingPredicate(ctx, id, DedicatedHostOperationPredicate{}) +} + +// ListByHostGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHostClient) ListByHostGroupCompleteMatchingPredicate(ctx context.Context, id commonids.DedicatedHostGroupId, predicate DedicatedHostOperationPredicate) (result ListByHostGroupCompleteResult, err error) { + items := make([]DedicatedHost, 0) + + resp, err := c.ListByHostGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByHostGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/method_redeploy.go b/resource-manager/compute/2024-11-01/dedicatedhost/method_redeploy.go new file mode 100644 index 00000000000..08a21c127fb --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/method_redeploy.go @@ -0,0 +1,70 @@ +package dedicatedhost + +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/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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c DedicatedHostClient) Redeploy(ctx context.Context, id commonids.DedicatedHostId) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c DedicatedHostClient) RedeployThenPoll(ctx context.Context, id commonids.DedicatedHostId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/method_restart.go b/resource-manager/compute/2024-11-01/dedicatedhost/method_restart.go new file mode 100644 index 00000000000..e5899268a83 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/method_restart.go @@ -0,0 +1,70 @@ +package dedicatedhost + +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/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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c DedicatedHostClient) Restart(ctx context.Context, id commonids.DedicatedHostId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c DedicatedHostClient) RestartThenPoll(ctx context.Context, id commonids.DedicatedHostId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhost.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhost.go new file mode 100644 index 00000000000..0331923f9cc --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhost.go @@ -0,0 +1,14 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHost struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostallocatablevm.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..ca805171fe0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostavailablecapacity.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..0014a241c7d --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostinstanceview.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostinstanceview.go new file mode 100644 index 00000000000..2622866f2e4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostinstanceview.go @@ -0,0 +1,10 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceView struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostproperties.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostproperties.go new file mode 100644 index 00000000000..b5eac64ba70 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostproperties.go @@ -0,0 +1,46 @@ +package dedicatedhost + +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 DedicatedHostProperties struct { + AutoReplaceOnFailure *bool `json:"autoReplaceOnFailure,omitempty"` + HostId *string `json:"hostId,omitempty"` + InstanceView *DedicatedHostInstanceView `json:"instanceView,omitempty"` + LicenseType *DedicatedHostLicenseTypes `json:"licenseType,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachines *[]SubResourceReadOnly `json:"virtualMachines,omitempty"` +} + +func (o *DedicatedHostProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *DedicatedHostProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostsizelistresult.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostsizelistresult.go new file mode 100644 index 00000000000..a67f9c39966 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_dedicatedhostsizelistresult.go @@ -0,0 +1,8 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostSizeListResult struct { + Value *[]string `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_instanceviewstatus.go new file mode 100644 index 00000000000..0c9537be6da --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhost + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_sku.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_sku.go new file mode 100644 index 00000000000..6cc80fac052 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_sku.go @@ -0,0 +1,10 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/model_subresourcereadonly.go b/resource-manager/compute/2024-11-01/dedicatedhost/model_subresourcereadonly.go new file mode 100644 index 00000000000..0240421d0c1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhost/predicates.go b/resource-manager/compute/2024-11-01/dedicatedhost/predicates.go new file mode 100644 index 00000000000..f3fee1b89c7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/predicates.go @@ -0,0 +1,32 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHostOperationPredicate) Matches(input DedicatedHost) 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/compute/2024-11-01/dedicatedhost/version.go b/resource-manager/compute/2024-11-01/dedicatedhost/version.go new file mode 100644 index 00000000000..b79976357b9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhost/version.go @@ -0,0 +1,10 @@ +package dedicatedhost + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dedicatedhost/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/README.md b/resource-manager/compute/2024-11-01/dedicatedhostgroups/README.md new file mode 100644 index 00000000000..c021a82aa44 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhostgroups` Documentation + +The `dedicatedhostgroups` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhostgroups" +``` + + +### Client Initialization + +```go +client := dedicatedhostgroups.NewDedicatedHostGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +payload := dedicatedhostgroups.DedicatedHostGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +read, err := client.Get(ctx, id, dedicatedhostgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `DedicatedHostGroupsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName") + +payload := dedicatedhostgroups.DedicatedHostGroupUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/client.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/client.go new file mode 100644 index 00000000000..1198b817462 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/client.go @@ -0,0 +1,26 @@ +package dedicatedhostgroups + +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 DedicatedHostGroupsClient struct { + Client *resourcemanager.Client +} + +func NewDedicatedHostGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*DedicatedHostGroupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dedicatedhostgroups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DedicatedHostGroupsClient: %+v", err) + } + + return &DedicatedHostGroupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/constants.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/constants.go new file mode 100644 index 00000000000..bf4042cc756 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/constants.go @@ -0,0 +1,95 @@ +package dedicatedhostgroups + +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 InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_createorupdate.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_createorupdate.go new file mode 100644 index 00000000000..4b26099152d --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_createorupdate.go @@ -0,0 +1,59 @@ +package dedicatedhostgroups + +import ( + "context" + "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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostGroup +} + +// CreateOrUpdate ... +func (c DedicatedHostGroupsClient) CreateOrUpdate(ctx context.Context, id commonids.DedicatedHostGroupId, input DedicatedHostGroup) (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 + } + + var model DedicatedHostGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_delete.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_delete.go new file mode 100644 index 00000000000..36bbed2ac40 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_delete.go @@ -0,0 +1,48 @@ +package dedicatedhostgroups + +import ( + "context" + "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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c DedicatedHostGroupsClient) Delete(ctx context.Context, id commonids.DedicatedHostGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_get.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_get.go new file mode 100644 index 00000000000..8d31b580668 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_get.go @@ -0,0 +1,84 @@ +package dedicatedhostgroups + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostGroup +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c DedicatedHostGroupsClient) Get(ctx context.Context, id commonids.DedicatedHostGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DedicatedHostGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbyresourcegroup.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbyresourcegroup.go new file mode 100644 index 00000000000..3fe766d2e65 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package dedicatedhostgroups + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DedicatedHostGroup +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []DedicatedHostGroup +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c DedicatedHostGroupsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/hostGroups", 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 *[]DedicatedHostGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c DedicatedHostGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, DedicatedHostGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHostGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate DedicatedHostGroupOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]DedicatedHostGroup, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbysubscription.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbysubscription.go new file mode 100644 index 00000000000..80e15ebf447 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_listbysubscription.go @@ -0,0 +1,106 @@ +package dedicatedhostgroups + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]DedicatedHostGroup +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []DedicatedHostGroup +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c DedicatedHostGroupsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/hostGroups", 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 *[]DedicatedHostGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c DedicatedHostGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, DedicatedHostGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c DedicatedHostGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate DedicatedHostGroupOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]DedicatedHostGroup, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_update.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_update.go new file mode 100644 index 00000000000..0bb7d2873f7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/method_update.go @@ -0,0 +1,58 @@ +package dedicatedhostgroups + +import ( + "context" + "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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHostGroup +} + +// Update ... +func (c DedicatedHostGroupsClient) Update(ctx context.Context, id commonids.DedicatedHostGroupId, input DedicatedHostGroupUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model DedicatedHostGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..6ba75a2253e --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..645a995fd14 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go new file mode 100644 index 00000000000..fd28b757052 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroup.go @@ -0,0 +1,18 @@ +package dedicatedhostgroups + +import ( + "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 DedicatedHostGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go new file mode 100644 index 00000000000..4f3f4179ea8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupinstanceview.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupInstanceView struct { + Hosts *[]DedicatedHostInstanceViewWithName `json:"hosts,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go new file mode 100644 index 00000000000..4b098a22db4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupproperties.go @@ -0,0 +1,12 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupProperties struct { + AdditionalCapabilities *DedicatedHostGroupPropertiesAdditionalCapabilities `json:"additionalCapabilities,omitempty"` + Hosts *[]SubResourceReadOnly `json:"hosts,omitempty"` + InstanceView *DedicatedHostGroupInstanceView `json:"instanceView,omitempty"` + PlatformFaultDomainCount int64 `json:"platformFaultDomainCount"` + SupportAutomaticPlacement *bool `json:"supportAutomaticPlacement,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go new file mode 100644 index 00000000000..296a2f029f4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgrouppropertiesadditionalcapabilities.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupPropertiesAdditionalCapabilities struct { + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go new file mode 100644 index 00000000000..dfa7c88e18e --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostgroupupdate.go @@ -0,0 +1,14 @@ +package dedicatedhostgroups + +import ( + "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 DedicatedHostGroupUpdate struct { + Properties *DedicatedHostGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go new file mode 100644 index 00000000000..e8c32278760 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_dedicatedhostinstanceviewwithname.go @@ -0,0 +1,11 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceViewWithName struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..74b66b61bc6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhostgroups + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_subresourcereadonly.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_subresourcereadonly.go new file mode 100644 index 00000000000..9c5ae8726a8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhostgroups/predicates.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/predicates.go new file mode 100644 index 00000000000..de1da527708 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/predicates.go @@ -0,0 +1,32 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p DedicatedHostGroupOperationPredicate) Matches(input DedicatedHostGroup) 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/compute/2024-11-01/dedicatedhostgroups/version.go b/resource-manager/compute/2024-11-01/dedicatedhostgroups/version.go new file mode 100644 index 00000000000..15d30a6fd22 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhostgroups/version.go @@ -0,0 +1,10 @@ +package dedicatedhostgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dedicatedhostgroups/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/README.md b/resource-manager/compute/2024-11-01/dedicatedhosts/README.md new file mode 100644 index 00000000000..6e5f0fe3002 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/README.md @@ -0,0 +1,83 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhosts` Documentation + +The `dedicatedhosts` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/dedicatedhosts" +``` + + +### Client Initialization + +```go +client := dedicatedhosts.NewDedicatedHostsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `DedicatedHostsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +payload := dedicatedhosts.DedicatedHost{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Delete` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `DedicatedHostsClient.Get` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +read, err := client.Get(ctx, id, dedicatedhosts.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `DedicatedHostsClient.Update` + +```go +ctx := context.TODO() +id := commonids.NewDedicatedHostID("12345678-1234-9876-4563-123456789012", "example-resource-group", "hostGroupName", "hostName") + +payload := dedicatedhosts.DedicatedHostUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/client.go b/resource-manager/compute/2024-11-01/dedicatedhosts/client.go new file mode 100644 index 00000000000..1f5bf6278f7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/client.go @@ -0,0 +1,26 @@ +package dedicatedhosts + +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 DedicatedHostsClient struct { + Client *resourcemanager.Client +} + +func NewDedicatedHostsClientWithBaseURI(sdkApi sdkEnv.Api) (*DedicatedHostsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "dedicatedhosts", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating DedicatedHostsClient: %+v", err) + } + + return &DedicatedHostsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/constants.go b/resource-manager/compute/2024-11-01/dedicatedhosts/constants.go new file mode 100644 index 00000000000..254059a67f1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/constants.go @@ -0,0 +1,139 @@ +package dedicatedhosts + +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 DedicatedHostLicenseTypes string + +const ( + DedicatedHostLicenseTypesNone DedicatedHostLicenseTypes = "None" + DedicatedHostLicenseTypesWindowsServerHybrid DedicatedHostLicenseTypes = "Windows_Server_Hybrid" + DedicatedHostLicenseTypesWindowsServerPerpetual DedicatedHostLicenseTypes = "Windows_Server_Perpetual" +) + +func PossibleValuesForDedicatedHostLicenseTypes() []string { + return []string{ + string(DedicatedHostLicenseTypesNone), + string(DedicatedHostLicenseTypesWindowsServerHybrid), + string(DedicatedHostLicenseTypesWindowsServerPerpetual), + } +} + +func (s *DedicatedHostLicenseTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDedicatedHostLicenseTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDedicatedHostLicenseTypes(input string) (*DedicatedHostLicenseTypes, error) { + vals := map[string]DedicatedHostLicenseTypes{ + "none": DedicatedHostLicenseTypesNone, + "windows_server_hybrid": DedicatedHostLicenseTypesWindowsServerHybrid, + "windows_server_perpetual": DedicatedHostLicenseTypesWindowsServerPerpetual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DedicatedHostLicenseTypes(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/method_createorupdate.go b/resource-manager/compute/2024-11-01/dedicatedhosts/method_createorupdate.go new file mode 100644 index 00000000000..f60b2b8c65f --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/method_createorupdate.go @@ -0,0 +1,76 @@ +package dedicatedhosts + +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/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHost +} + +// CreateOrUpdate ... +func (c DedicatedHostsClient) CreateOrUpdate(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHost) (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 DedicatedHostsClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHost) 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/compute/2024-11-01/dedicatedhosts/method_delete.go b/resource-manager/compute/2024-11-01/dedicatedhosts/method_delete.go new file mode 100644 index 00000000000..fa479498bbe --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/method_delete.go @@ -0,0 +1,72 @@ +package dedicatedhosts + +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/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 DedicatedHostsClient) Delete(ctx context.Context, id commonids.DedicatedHostId) (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 DedicatedHostsClient) DeleteThenPoll(ctx context.Context, id commonids.DedicatedHostId) 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/compute/2024-11-01/dedicatedhosts/method_get.go b/resource-manager/compute/2024-11-01/dedicatedhosts/method_get.go new file mode 100644 index 00000000000..ae7a03232ad --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/method_get.go @@ -0,0 +1,84 @@ +package dedicatedhosts + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHost +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c DedicatedHostsClient) Get(ctx context.Context, id commonids.DedicatedHostId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model DedicatedHost + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/method_update.go b/resource-manager/compute/2024-11-01/dedicatedhosts/method_update.go new file mode 100644 index 00000000000..6d289567e58 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/method_update.go @@ -0,0 +1,75 @@ +package dedicatedhosts + +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/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *DedicatedHost +} + +// Update ... +func (c DedicatedHostsClient) Update(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHostUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 DedicatedHostsClient) UpdateThenPoll(ctx context.Context, id commonids.DedicatedHostId, input DedicatedHostUpdate) 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/compute/2024-11-01/dedicatedhosts/model_dedicatedhost.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhost.go new file mode 100644 index 00000000000..c5b706c12d8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhost.go @@ -0,0 +1,14 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHost struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Sku Sku `json:"sku"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go new file mode 100644 index 00000000000..9b56e28f2ff --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostallocatablevm.go @@ -0,0 +1,9 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAllocatableVM struct { + Count *float64 `json:"count,omitempty"` + VMSize *string `json:"vmSize,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go new file mode 100644 index 00000000000..4a815b0460c --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostavailablecapacity.go @@ -0,0 +1,8 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostAvailableCapacity struct { + AllocatableVMs *[]DedicatedHostAllocatableVM `json:"allocatableVMs,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go new file mode 100644 index 00000000000..7574083ca0d --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostinstanceview.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostInstanceView struct { + AssetId *string `json:"assetId,omitempty"` + AvailableCapacity *DedicatedHostAvailableCapacity `json:"availableCapacity,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostproperties.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostproperties.go new file mode 100644 index 00000000000..067483736a4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostproperties.go @@ -0,0 +1,46 @@ +package dedicatedhosts + +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 DedicatedHostProperties struct { + AutoReplaceOnFailure *bool `json:"autoReplaceOnFailure,omitempty"` + HostId *string `json:"hostId,omitempty"` + InstanceView *DedicatedHostInstanceView `json:"instanceView,omitempty"` + LicenseType *DedicatedHostLicenseTypes `json:"licenseType,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProvisioningTime *string `json:"provisioningTime,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + VirtualMachines *[]SubResourceReadOnly `json:"virtualMachines,omitempty"` +} + +func (o *DedicatedHostProperties) GetProvisioningTimeAsTime() (*time.Time, error) { + if o.ProvisioningTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ProvisioningTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetProvisioningTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ProvisioningTime = &formatted +} + +func (o *DedicatedHostProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *DedicatedHostProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostupdate.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostupdate.go new file mode 100644 index 00000000000..987da669393 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_dedicatedhostupdate.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DedicatedHostUpdate struct { + Properties *DedicatedHostProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_instanceviewstatus.go new file mode 100644 index 00000000000..fe3a89546ec --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package dedicatedhosts + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_sku.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_sku.go new file mode 100644 index 00000000000..ce3dda6ffbe --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_sku.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/model_subresourcereadonly.go b/resource-manager/compute/2024-11-01/dedicatedhosts/model_subresourcereadonly.go new file mode 100644 index 00000000000..91dea24f8e1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/model_subresourcereadonly.go @@ -0,0 +1,8 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceReadOnly struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/dedicatedhosts/version.go b/resource-manager/compute/2024-11-01/dedicatedhosts/version.go new file mode 100644 index 00000000000..7ee32a0e02b --- /dev/null +++ b/resource-manager/compute/2024-11-01/dedicatedhosts/version.go @@ -0,0 +1,10 @@ +package dedicatedhosts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/dedicatedhosts/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/images/README.md b/resource-manager/compute/2024-11-01/images/README.md new file mode 100644 index 00000000000..d7035217363 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/README.md @@ -0,0 +1,117 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/images` Documentation + +The `images` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/images" +``` + + +### Client Initialization + +```go +client := images.NewImagesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ImagesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +payload := images.Image{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ImagesClient.Delete` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `ImagesClient.Get` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +read, err := client.Get(ctx, id, images.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ImagesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// 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: `ImagesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ImagesClient.Update` + +```go +ctx := context.TODO() +id := images.NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + +payload := images.ImageUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/images/client.go b/resource-manager/compute/2024-11-01/images/client.go new file mode 100644 index 00000000000..1732ff32057 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/client.go @@ -0,0 +1,26 @@ +package images + +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 ImagesClient struct { + Client *resourcemanager.Client +} + +func NewImagesClientWithBaseURI(sdkApi sdkEnv.Api) (*ImagesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "images", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ImagesClient: %+v", err) + } + + return &ImagesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/images/constants.go b/resource-manager/compute/2024-11-01/images/constants.go new file mode 100644 index 00000000000..5853a41b563 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/constants.go @@ -0,0 +1,233 @@ +package images + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type OperatingSystemStateTypes string + +const ( + OperatingSystemStateTypesGeneralized OperatingSystemStateTypes = "Generalized" + OperatingSystemStateTypesSpecialized OperatingSystemStateTypes = "Specialized" +) + +func PossibleValuesForOperatingSystemStateTypes() []string { + return []string{ + string(OperatingSystemStateTypesGeneralized), + string(OperatingSystemStateTypesSpecialized), + } +} + +func (s *OperatingSystemStateTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemStateTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemStateTypes(input string) (*OperatingSystemStateTypes, error) { + vals := map[string]OperatingSystemStateTypes{ + "generalized": OperatingSystemStateTypesGeneralized, + "specialized": OperatingSystemStateTypesSpecialized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemStateTypes(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/images/id_image.go b/resource-manager/compute/2024-11-01/images/id_image.go new file mode 100644 index 00000000000..1ea81358052 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/id_image.go @@ -0,0 +1,130 @@ +package images + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ImageId{}) +} + +var _ resourceids.ResourceId = &ImageId{} + +// ImageId is a struct representing the Resource ID for a Image +type ImageId struct { + SubscriptionId string + ResourceGroupName string + ImageName string +} + +// NewImageID returns a new ImageId struct +func NewImageID(subscriptionId string, resourceGroupName string, imageName string) ImageId { + return ImageId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ImageName: imageName, + } +} + +// ParseImageID parses 'input' into a ImageId +func ParseImageID(input string) (*ImageId, error) { + parser := resourceids.NewParserFromResourceIdType(&ImageId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ImageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseImageIDInsensitively parses 'input' case-insensitively into a ImageId +// note: this method should only be used for API response data and not user input +func ParseImageIDInsensitively(input string) (*ImageId, error) { + parser := resourceids.NewParserFromResourceIdType(&ImageId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ImageId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ImageId) 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.ImageName, ok = input.Parsed["imageName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "imageName", input) + } + + return nil +} + +// ValidateImageID checks that 'input' can be parsed as a Image ID +func ValidateImageID(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 := ParseImageID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Image ID +func (id ImageId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/images/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ImageName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Image ID +func (id ImageId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticImages", "images", "images"), + resourceids.UserSpecifiedSegment("imageName", "imageName"), + } +} + +// String returns a human-readable description of this Image ID +func (id ImageId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Image Name: %q", id.ImageName), + } + return fmt.Sprintf("Image (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/images/id_image_test.go b/resource-manager/compute/2024-11-01/images/id_image_test.go new file mode 100644 index 00000000000..b3214493513 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/id_image_test.go @@ -0,0 +1,282 @@ +package images + +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 = &ImageId{} + +func TestNewImageID(t *testing.T) { + id := NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName") + + 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.ImageName != "imageName" { + t.Fatalf("Expected %q but got %q for Segment 'ImageName'", id.ImageName, "imageName") + } +} + +func TestFormatImageID(t *testing.T) { + actual := NewImageID("12345678-1234-9876-4563-123456789012", "example-resource-group", "imageName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseImageID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ImageId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName", + Expected: &ImageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ImageName: "imageName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseImageID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.ImageName != v.Expected.ImageName { + t.Fatalf("Expected %q but got %q for ImageName", v.Expected.ImageName, actual.ImageName) + } + + } +} + +func TestParseImageIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ImageId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/iMaGeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName", + Expected: &ImageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ImageName: "imageName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/images/imageName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/iMaGeS/iMaGeNaMe", + Expected: &ImageId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ImageName: "iMaGeNaMe", + }, + }, + { + // 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.cOmPuTe/iMaGeS/iMaGeNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseImageIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.ImageName != v.Expected.ImageName { + t.Fatalf("Expected %q but got %q for ImageName", v.Expected.ImageName, actual.ImageName) + } + + } +} + +func TestSegmentsForImageId(t *testing.T) { + segments := ImageId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ImageId 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/compute/2024-11-01/images/method_createorupdate.go b/resource-manager/compute/2024-11-01/images/method_createorupdate.go new file mode 100644 index 00000000000..58619868542 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/method_createorupdate.go @@ -0,0 +1,75 @@ +package images + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Image +} + +// CreateOrUpdate ... +func (c ImagesClient) CreateOrUpdate(ctx context.Context, id ImageId, input Image) (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 ImagesClient) CreateOrUpdateThenPoll(ctx context.Context, id ImageId, input Image) 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/compute/2024-11-01/images/method_delete.go b/resource-manager/compute/2024-11-01/images/method_delete.go new file mode 100644 index 00000000000..c16dbfc84c5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/method_delete.go @@ -0,0 +1,71 @@ +package images + +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 ImagesClient) Delete(ctx context.Context, id ImageId) (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 ImagesClient) DeleteThenPoll(ctx context.Context, id ImageId) 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/compute/2024-11-01/images/method_get.go b/resource-manager/compute/2024-11-01/images/method_get.go new file mode 100644 index 00000000000..e68f9e933bb --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/method_get.go @@ -0,0 +1,83 @@ +package images + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Image +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c ImagesClient) Get(ctx context.Context, id ImageId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Image + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/images/method_list.go b/resource-manager/compute/2024-11-01/images/method_list.go new file mode 100644 index 00000000000..9a78161d8aa --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/method_list.go @@ -0,0 +1,106 @@ +package images + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Image +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Image +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c ImagesClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/images", 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 *[]Image `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 ImagesClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, ImageOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ImagesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ImageOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Image, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/images/method_listbyresourcegroup.go b/resource-manager/compute/2024-11-01/images/method_listbyresourcegroup.go new file mode 100644 index 00000000000..3026c68a08f --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package images + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Image +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Image +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ImagesClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/images", 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 *[]Image `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ImagesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ImageOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ImagesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ImageOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Image, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/images/method_update.go b/resource-manager/compute/2024-11-01/images/method_update.go new file mode 100644 index 00000000000..4c98d0bf0d0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/method_update.go @@ -0,0 +1,75 @@ +package images + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *Image +} + +// Update ... +func (c ImagesClient) Update(ctx context.Context, id ImageId, input ImageUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + 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 ImagesClient) UpdateThenPoll(ctx context.Context, id ImageId, input ImageUpdate) 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/compute/2024-11-01/images/model_image.go b/resource-manager/compute/2024-11-01/images/model_image.go new file mode 100644 index 00000000000..5bf264eae8e --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_image.go @@ -0,0 +1,18 @@ +package images + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Image struct { + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ImageProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/model_imagedatadisk.go b/resource-manager/compute/2024-11-01/images/model_imagedatadisk.go new file mode 100644 index 00000000000..10ac758fce6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_imagedatadisk.go @@ -0,0 +1,15 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageDataDisk struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *CachingTypes `json:"caching,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + Snapshot *SubResource `json:"snapshot,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/model_imageosdisk.go b/resource-manager/compute/2024-11-01/images/model_imageosdisk.go new file mode 100644 index 00000000000..8bfa64c5ce8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_imageosdisk.go @@ -0,0 +1,16 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageOSDisk struct { + BlobUri *string `json:"blobUri,omitempty"` + Caching *CachingTypes `json:"caching,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + ManagedDisk *SubResource `json:"managedDisk,omitempty"` + OsState OperatingSystemStateTypes `json:"osState"` + OsType OperatingSystemTypes `json:"osType"` + Snapshot *SubResource `json:"snapshot,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/model_imageproperties.go b/resource-manager/compute/2024-11-01/images/model_imageproperties.go new file mode 100644 index 00000000000..38a45c0e091 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_imageproperties.go @@ -0,0 +1,11 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageProperties struct { + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceVirtualMachine *SubResource `json:"sourceVirtualMachine,omitempty"` + StorageProfile *ImageStorageProfile `json:"storageProfile,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/model_imagestorageprofile.go b/resource-manager/compute/2024-11-01/images/model_imagestorageprofile.go new file mode 100644 index 00000000000..2629dfc3475 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_imagestorageprofile.go @@ -0,0 +1,10 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageStorageProfile struct { + DataDisks *[]ImageDataDisk `json:"dataDisks,omitempty"` + OsDisk *ImageOSDisk `json:"osDisk,omitempty"` + ZoneResilient *bool `json:"zoneResilient,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/model_imageupdate.go b/resource-manager/compute/2024-11-01/images/model_imageupdate.go new file mode 100644 index 00000000000..1fb6b4c2c5c --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_imageupdate.go @@ -0,0 +1,9 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageUpdate struct { + Properties *ImageProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/model_subresource.go b/resource-manager/compute/2024-11-01/images/model_subresource.go new file mode 100644 index 00000000000..8ca624bc417 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/model_subresource.go @@ -0,0 +1,8 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/images/predicates.go b/resource-manager/compute/2024-11-01/images/predicates.go new file mode 100644 index 00000000000..7d036d2c839 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/predicates.go @@ -0,0 +1,32 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ImageOperationPredicate) Matches(input Image) 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/compute/2024-11-01/images/version.go b/resource-manager/compute/2024-11-01/images/version.go new file mode 100644 index 00000000000..ce48f3c5695 --- /dev/null +++ b/resource-manager/compute/2024-11-01/images/version.go @@ -0,0 +1,10 @@ +package images + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/images/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/README.md b/resource-manager/compute/2024-11-01/loganalytics/README.md new file mode 100644 index 00000000000..c506677e49b --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/README.md @@ -0,0 +1,54 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/loganalytics` Documentation + +The `loganalytics` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/loganalytics" +``` + + +### Client Initialization + +```go +client := loganalytics.NewLogAnalyticsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LogAnalyticsClient.ExportRequestRateByInterval` + +```go +ctx := context.TODO() +id := loganalytics.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := loganalytics.RequestRateByIntervalInput{ + // ... +} + + +if err := client.ExportRequestRateByIntervalThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `LogAnalyticsClient.ExportThrottledRequests` + +```go +ctx := context.TODO() +id := loganalytics.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +payload := loganalytics.LogAnalyticsInputBase{ + // ... +} + + +if err := client.ExportThrottledRequestsThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/loganalytics/client.go b/resource-manager/compute/2024-11-01/loganalytics/client.go new file mode 100644 index 00000000000..b32a74cf728 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/client.go @@ -0,0 +1,26 @@ +package loganalytics + +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 LogAnalyticsClient struct { + Client *resourcemanager.Client +} + +func NewLogAnalyticsClientWithBaseURI(sdkApi sdkEnv.Api) (*LogAnalyticsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "loganalytics", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating LogAnalyticsClient: %+v", err) + } + + return &LogAnalyticsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/constants.go b/resource-manager/compute/2024-11-01/loganalytics/constants.go new file mode 100644 index 00000000000..21b0396e045 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/constants.go @@ -0,0 +1,57 @@ +package loganalytics + +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 IntervalInMins string + +const ( + IntervalInMinsFiveMins IntervalInMins = "FiveMins" + IntervalInMinsSixtyMins IntervalInMins = "SixtyMins" + IntervalInMinsThirtyMins IntervalInMins = "ThirtyMins" + IntervalInMinsThreeMins IntervalInMins = "ThreeMins" +) + +func PossibleValuesForIntervalInMins() []string { + return []string{ + string(IntervalInMinsFiveMins), + string(IntervalInMinsSixtyMins), + string(IntervalInMinsThirtyMins), + string(IntervalInMinsThreeMins), + } +} + +func (s *IntervalInMins) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIntervalInMins(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIntervalInMins(input string) (*IntervalInMins, error) { + vals := map[string]IntervalInMins{ + "fivemins": IntervalInMinsFiveMins, + "sixtymins": IntervalInMinsSixtyMins, + "thirtymins": IntervalInMinsThirtyMins, + "threemins": IntervalInMinsThreeMins, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IntervalInMins(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/id_location.go b/resource-manager/compute/2024-11-01/loganalytics/id_location.go new file mode 100644 index 00000000000..893525660f2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/id_location.go @@ -0,0 +1,121 @@ +package loganalytics + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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.Compute/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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/compute/2024-11-01/loganalytics/id_location_test.go b/resource-manager/compute/2024-11-01/loganalytics/id_location_test.go new file mode 100644 index 00000000000..76eb5c3f415 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/id_location_test.go @@ -0,0 +1,237 @@ +package loganalytics + +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", "locationName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/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/compute/2024-11-01/loganalytics/method_exportrequestratebyinterval.go b/resource-manager/compute/2024-11-01/loganalytics/method_exportrequestratebyinterval.go new file mode 100644 index 00000000000..650820f7095 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/method_exportrequestratebyinterval.go @@ -0,0 +1,75 @@ +package loganalytics + +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 ExportRequestRateByIntervalOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *LogAnalyticsOperationResult +} + +// ExportRequestRateByInterval ... +func (c LogAnalyticsClient) ExportRequestRateByInterval(ctx context.Context, id LocationId, input RequestRateByIntervalInput) (result ExportRequestRateByIntervalOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/logAnalytics/apiAccess/getRequestRateByInterval", 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 +} + +// ExportRequestRateByIntervalThenPoll performs ExportRequestRateByInterval then polls until it's completed +func (c LogAnalyticsClient) ExportRequestRateByIntervalThenPoll(ctx context.Context, id LocationId, input RequestRateByIntervalInput) error { + result, err := c.ExportRequestRateByInterval(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExportRequestRateByInterval: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ExportRequestRateByInterval: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/method_exportthrottledrequests.go b/resource-manager/compute/2024-11-01/loganalytics/method_exportthrottledrequests.go new file mode 100644 index 00000000000..07f30fe6d8b --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/method_exportthrottledrequests.go @@ -0,0 +1,75 @@ +package loganalytics + +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 ExportThrottledRequestsOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *LogAnalyticsOperationResult +} + +// ExportThrottledRequests ... +func (c LogAnalyticsClient) ExportThrottledRequests(ctx context.Context, id LocationId, input LogAnalyticsInputBase) (result ExportThrottledRequestsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/logAnalytics/apiAccess/getThrottledRequests", 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 +} + +// ExportThrottledRequestsThenPoll performs ExportThrottledRequests then polls until it's completed +func (c LogAnalyticsClient) ExportThrottledRequestsThenPoll(ctx context.Context, id LocationId, input LogAnalyticsInputBase) error { + result, err := c.ExportThrottledRequests(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ExportThrottledRequests: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ExportThrottledRequests: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsinputbase.go b/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsinputbase.go new file mode 100644 index 00000000000..8a6acb01e7e --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsinputbase.go @@ -0,0 +1,39 @@ +package loganalytics + +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 LogAnalyticsInputBase struct { + BlobContainerSasUri string `json:"blobContainerSasUri"` + FromTime string `json:"fromTime"` + GroupByClientApplicationId *bool `json:"groupByClientApplicationId,omitempty"` + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + ToTime string `json:"toTime"` +} + +func (o *LogAnalyticsInputBase) GetFromTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.FromTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogAnalyticsInputBase) SetFromTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FromTime = formatted +} + +func (o *LogAnalyticsInputBase) GetToTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ToTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LogAnalyticsInputBase) SetToTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ToTime = formatted +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoperationresult.go b/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoperationresult.go new file mode 100644 index 00000000000..6a0b1af99be --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoperationresult.go @@ -0,0 +1,8 @@ +package loganalytics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsOperationResult struct { + Properties *LogAnalyticsOutput `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoutput.go b/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoutput.go new file mode 100644 index 00000000000..2702daf45db --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/model_loganalyticsoutput.go @@ -0,0 +1,8 @@ +package loganalytics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LogAnalyticsOutput struct { + Output *string `json:"output,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/model_requestratebyintervalinput.go b/resource-manager/compute/2024-11-01/loganalytics/model_requestratebyintervalinput.go new file mode 100644 index 00000000000..b0a10092cf6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/model_requestratebyintervalinput.go @@ -0,0 +1,40 @@ +package loganalytics + +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 RequestRateByIntervalInput struct { + BlobContainerSasUri string `json:"blobContainerSasUri"` + FromTime string `json:"fromTime"` + GroupByClientApplicationId *bool `json:"groupByClientApplicationId,omitempty"` + GroupByOperationName *bool `json:"groupByOperationName,omitempty"` + GroupByResourceName *bool `json:"groupByResourceName,omitempty"` + GroupByThrottlePolicy *bool `json:"groupByThrottlePolicy,omitempty"` + GroupByUserAgent *bool `json:"groupByUserAgent,omitempty"` + IntervalLength IntervalInMins `json:"intervalLength"` + ToTime string `json:"toTime"` +} + +func (o *RequestRateByIntervalInput) GetFromTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.FromTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RequestRateByIntervalInput) SetFromTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.FromTime = formatted +} + +func (o *RequestRateByIntervalInput) GetToTimeAsTime() (*time.Time, error) { + return dates.ParseAsFormat(&o.ToTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RequestRateByIntervalInput) SetToTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ToTime = formatted +} diff --git a/resource-manager/compute/2024-11-01/loganalytics/version.go b/resource-manager/compute/2024-11-01/loganalytics/version.go new file mode 100644 index 00000000000..06e1255bb60 --- /dev/null +++ b/resource-manager/compute/2024-11-01/loganalytics/version.go @@ -0,0 +1,10 @@ +package loganalytics + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/loganalytics/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/README.md b/resource-manager/compute/2024-11-01/proximityplacementgroups/README.md new file mode 100644 index 00000000000..1a5e2c91b4b --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/proximityplacementgroups` Documentation + +The `proximityplacementgroups` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/proximityplacementgroups" +``` + + +### Client Initialization + +```go +client := proximityplacementgroups.NewProximityPlacementGroupsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ProximityPlacementGroupsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +payload := proximityplacementgroups.ProximityPlacementGroup{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Delete` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Get` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +read, err := client.Get(ctx, id, proximityplacementgroups.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `ProximityPlacementGroupsClient.Update` + +```go +ctx := context.TODO() +id := proximityplacementgroups.NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + +payload := proximityplacementgroups.UpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/client.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/client.go new file mode 100644 index 00000000000..1a6cf3adbc3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/client.go @@ -0,0 +1,26 @@ +package proximityplacementgroups + +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 ProximityPlacementGroupsClient struct { + Client *resourcemanager.Client +} + +func NewProximityPlacementGroupsClientWithBaseURI(sdkApi sdkEnv.Api) (*ProximityPlacementGroupsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "proximityplacementgroups", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ProximityPlacementGroupsClient: %+v", err) + } + + return &ProximityPlacementGroupsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/constants.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/constants.go new file mode 100644 index 00000000000..7515ef8b9d7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/constants.go @@ -0,0 +1,95 @@ +package proximityplacementgroups + +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 ProximityPlacementGroupType string + +const ( + ProximityPlacementGroupTypeStandard ProximityPlacementGroupType = "Standard" + ProximityPlacementGroupTypeUltra ProximityPlacementGroupType = "Ultra" +) + +func PossibleValuesForProximityPlacementGroupType() []string { + return []string{ + string(ProximityPlacementGroupTypeStandard), + string(ProximityPlacementGroupTypeUltra), + } +} + +func (s *ProximityPlacementGroupType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProximityPlacementGroupType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProximityPlacementGroupType(input string) (*ProximityPlacementGroupType, error) { + vals := map[string]ProximityPlacementGroupType{ + "standard": ProximityPlacementGroupTypeStandard, + "ultra": ProximityPlacementGroupTypeUltra, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProximityPlacementGroupType(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup.go new file mode 100644 index 00000000000..0f46e6f2844 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup.go @@ -0,0 +1,130 @@ +package proximityplacementgroups + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ProximityPlacementGroupId{}) +} + +var _ resourceids.ResourceId = &ProximityPlacementGroupId{} + +// ProximityPlacementGroupId is a struct representing the Resource ID for a Proximity Placement Group +type ProximityPlacementGroupId struct { + SubscriptionId string + ResourceGroupName string + ProximityPlacementGroupName string +} + +// NewProximityPlacementGroupID returns a new ProximityPlacementGroupId struct +func NewProximityPlacementGroupID(subscriptionId string, resourceGroupName string, proximityPlacementGroupName string) ProximityPlacementGroupId { + return ProximityPlacementGroupId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + ProximityPlacementGroupName: proximityPlacementGroupName, + } +} + +// ParseProximityPlacementGroupID parses 'input' into a ProximityPlacementGroupId +func ParseProximityPlacementGroupID(input string) (*ProximityPlacementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProximityPlacementGroupId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProximityPlacementGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseProximityPlacementGroupIDInsensitively parses 'input' case-insensitively into a ProximityPlacementGroupId +// note: this method should only be used for API response data and not user input +func ParseProximityPlacementGroupIDInsensitively(input string) (*ProximityPlacementGroupId, error) { + parser := resourceids.NewParserFromResourceIdType(&ProximityPlacementGroupId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ProximityPlacementGroupId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ProximityPlacementGroupId) 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.ProximityPlacementGroupName, ok = input.Parsed["proximityPlacementGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "proximityPlacementGroupName", input) + } + + return nil +} + +// ValidateProximityPlacementGroupID checks that 'input' can be parsed as a Proximity Placement Group ID +func ValidateProximityPlacementGroupID(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 := ParseProximityPlacementGroupID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Proximity Placement Group ID +func (id ProximityPlacementGroupId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/proximityPlacementGroups/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.ProximityPlacementGroupName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Proximity Placement Group ID +func (id ProximityPlacementGroupId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticProximityPlacementGroups", "proximityPlacementGroups", "proximityPlacementGroups"), + resourceids.UserSpecifiedSegment("proximityPlacementGroupName", "proximityPlacementGroupName"), + } +} + +// String returns a human-readable description of this Proximity Placement Group ID +func (id ProximityPlacementGroupId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Proximity Placement Group Name: %q", id.ProximityPlacementGroupName), + } + return fmt.Sprintf("Proximity Placement Group (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup_test.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup_test.go new file mode 100644 index 00000000000..726fe9b2288 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/id_proximityplacementgroup_test.go @@ -0,0 +1,282 @@ +package proximityplacementgroups + +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 = &ProximityPlacementGroupId{} + +func TestNewProximityPlacementGroupID(t *testing.T) { + id := NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName") + + 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.ProximityPlacementGroupName != "proximityPlacementGroupName" { + t.Fatalf("Expected %q but got %q for Segment 'ProximityPlacementGroupName'", id.ProximityPlacementGroupName, "proximityPlacementGroupName") + } +} + +func TestFormatProximityPlacementGroupID(t *testing.T) { + actual := NewProximityPlacementGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group", "proximityPlacementGroupName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseProximityPlacementGroupID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProximityPlacementGroupId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName", + Expected: &ProximityPlacementGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ProximityPlacementGroupName: "proximityPlacementGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProximityPlacementGroupID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.ProximityPlacementGroupName != v.Expected.ProximityPlacementGroupName { + t.Fatalf("Expected %q but got %q for ProximityPlacementGroupName", v.Expected.ProximityPlacementGroupName, actual.ProximityPlacementGroupName) + } + + } +} + +func TestParseProximityPlacementGroupIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ProximityPlacementGroupId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/pRoXiMiTyPlAcEmEnTgRoUpS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName", + Expected: &ProximityPlacementGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + ProximityPlacementGroupName: "proximityPlacementGroupName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/proximityPlacementGroups/proximityPlacementGroupName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/pRoXiMiTyPlAcEmEnTgRoUpS/pRoXiMiTyPlAcEmEnTgRoUpNaMe", + Expected: &ProximityPlacementGroupId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + ProximityPlacementGroupName: "pRoXiMiTyPlAcEmEnTgRoUpNaMe", + }, + }, + { + // 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.cOmPuTe/pRoXiMiTyPlAcEmEnTgRoUpS/pRoXiMiTyPlAcEmEnTgRoUpNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseProximityPlacementGroupIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.ProximityPlacementGroupName != v.Expected.ProximityPlacementGroupName { + t.Fatalf("Expected %q but got %q for ProximityPlacementGroupName", v.Expected.ProximityPlacementGroupName, actual.ProximityPlacementGroupName) + } + + } +} + +func TestSegmentsForProximityPlacementGroupId(t *testing.T) { + segments := ProximityPlacementGroupId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ProximityPlacementGroupId 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/compute/2024-11-01/proximityplacementgroups/method_createorupdate.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_createorupdate.go new file mode 100644 index 00000000000..b52985d0f6c --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_createorupdate.go @@ -0,0 +1,58 @@ +package proximityplacementgroups + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProximityPlacementGroup +} + +// CreateOrUpdate ... +func (c ProximityPlacementGroupsClient) CreateOrUpdate(ctx context.Context, id ProximityPlacementGroupId, input ProximityPlacementGroup) (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 + } + + var model ProximityPlacementGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/method_delete.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_delete.go new file mode 100644 index 00000000000..a299e26f62a --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_delete.go @@ -0,0 +1,46 @@ +package proximityplacementgroups + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c ProximityPlacementGroupsClient) Delete(ctx context.Context, id ProximityPlacementGroupId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/method_get.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_get.go new file mode 100644 index 00000000000..9319acd4f9b --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_get.go @@ -0,0 +1,83 @@ +package proximityplacementgroups + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProximityPlacementGroup +} + +type GetOperationOptions struct { + IncludeColocationStatus *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.IncludeColocationStatus != nil { + out.Append("includeColocationStatus", fmt.Sprintf("%v", *o.IncludeColocationStatus)) + } + return &out +} + +// Get ... +func (c ProximityPlacementGroupsClient) Get(ctx context.Context, id ProximityPlacementGroupId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model ProximityPlacementGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbyresourcegroup.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbyresourcegroup.go new file mode 100644 index 00000000000..1a30eaa36b4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package proximityplacementgroups + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProximityPlacementGroup +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []ProximityPlacementGroup +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c ProximityPlacementGroupsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/proximityPlacementGroups", 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 *[]ProximityPlacementGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c ProximityPlacementGroupsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, ProximityPlacementGroupOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProximityPlacementGroupsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate ProximityPlacementGroupOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]ProximityPlacementGroup, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbysubscription.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbysubscription.go new file mode 100644 index 00000000000..6cc0adf42da --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_listbysubscription.go @@ -0,0 +1,106 @@ +package proximityplacementgroups + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]ProximityPlacementGroup +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []ProximityPlacementGroup +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c ProximityPlacementGroupsClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/proximityPlacementGroups", 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 *[]ProximityPlacementGroup `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c ProximityPlacementGroupsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, ProximityPlacementGroupOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c ProximityPlacementGroupsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate ProximityPlacementGroupOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]ProximityPlacementGroup, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/method_update.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_update.go new file mode 100644 index 00000000000..dd8d1e3003a --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/method_update.go @@ -0,0 +1,57 @@ +package proximityplacementgroups + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *ProximityPlacementGroup +} + +// Update ... +func (c ProximityPlacementGroupsClient) Update(ctx context.Context, id ProximityPlacementGroupId, input UpdateResource) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model ProximityPlacementGroup + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_instanceviewstatus.go new file mode 100644 index 00000000000..3b148b1d660 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package proximityplacementgroups + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroup.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroup.go new file mode 100644 index 00000000000..69af2dfcddb --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroup.go @@ -0,0 +1,18 @@ +package proximityplacementgroups + +import ( + "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 ProximityPlacementGroup struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *ProximityPlacementGroupProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go new file mode 100644 index 00000000000..0c200d2620e --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgroupproperties.go @@ -0,0 +1,13 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupProperties struct { + AvailabilitySets *[]SubResourceWithColocationStatus `json:"availabilitySets,omitempty"` + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + Intent *ProximityPlacementGroupPropertiesIntent `json:"intent,omitempty"` + ProximityPlacementGroupType *ProximityPlacementGroupType `json:"proximityPlacementGroupType,omitempty"` + VirtualMachineScaleSets *[]SubResourceWithColocationStatus `json:"virtualMachineScaleSets,omitempty"` + VirtualMachines *[]SubResourceWithColocationStatus `json:"virtualMachines,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go new file mode 100644 index 00000000000..d159d0d2847 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_proximityplacementgrouppropertiesintent.go @@ -0,0 +1,8 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupPropertiesIntent struct { + VMSizes *[]string `json:"vmSizes,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go new file mode 100644 index 00000000000..a6c493baa63 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_subresourcewithcolocationstatus.go @@ -0,0 +1,9 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResourceWithColocationStatus struct { + ColocationStatus *InstanceViewStatus `json:"colocationStatus,omitempty"` + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/model_updateresource.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_updateresource.go new file mode 100644 index 00000000000..0c63bc1293b --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/model_updateresource.go @@ -0,0 +1,8 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateResource struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/proximityplacementgroups/predicates.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/predicates.go new file mode 100644 index 00000000000..3e0bc38e4a2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/predicates.go @@ -0,0 +1,32 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProximityPlacementGroupOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p ProximityPlacementGroupOperationPredicate) Matches(input ProximityPlacementGroup) 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/compute/2024-11-01/proximityplacementgroups/version.go b/resource-manager/compute/2024-11-01/proximityplacementgroups/version.go new file mode 100644 index 00000000000..56719c61d29 --- /dev/null +++ b/resource-manager/compute/2024-11-01/proximityplacementgroups/version.go @@ -0,0 +1,10 @@ +package proximityplacementgroups + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/proximityplacementgroups/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/README.md b/resource-manager/compute/2024-11-01/restorepointcollections/README.md new file mode 100644 index 00000000000..d411bdf07cb --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/README.md @@ -0,0 +1,125 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/restorepointcollections` Documentation + +The `restorepointcollections` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/restorepointcollections" +``` + + +### Client Initialization + +```go +client := restorepointcollections.NewRestorePointCollectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RestorePointCollectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +payload := restorepointcollections.RestorePointCollection{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RestorePointCollectionsClient.Delete` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RestorePointCollectionsClient.Get` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +read, err := client.Get(ctx, id, restorepointcollections.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `RestorePointCollectionsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// 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: `RestorePointCollectionsClient.ListAll` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id)` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `RestorePointCollectionsClient.Update` + +```go +ctx := context.TODO() +id := restorepointcollections.NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + +payload := restorepointcollections.RestorePointCollectionUpdate{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/client.go b/resource-manager/compute/2024-11-01/restorepointcollections/client.go new file mode 100644 index 00000000000..543d327725d --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/client.go @@ -0,0 +1,26 @@ +package restorepointcollections + +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 RestorePointCollectionsClient struct { + Client *resourcemanager.Client +} + +func NewRestorePointCollectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*RestorePointCollectionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "restorepointcollections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RestorePointCollectionsClient: %+v", err) + } + + return &RestorePointCollectionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/constants.go b/resource-manager/compute/2024-11-01/restorepointcollections/constants.go new file mode 100644 index 00000000000..5df0189321b --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/constants.go @@ -0,0 +1,1525 @@ +package restorepointcollections + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentNames string + +const ( + ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentNames() []string { + return []string{ + string(ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentNames(input string) (*ComponentNames, error) { + vals := map[string]ComponentNames{ + "microsoft-windows-shell-setup": ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentNames(input) + return &out, nil +} + +type ConsistencyModeTypes string + +const ( + ConsistencyModeTypesApplicationConsistent ConsistencyModeTypes = "ApplicationConsistent" + ConsistencyModeTypesCrashConsistent ConsistencyModeTypes = "CrashConsistent" + ConsistencyModeTypesFileSystemConsistent ConsistencyModeTypes = "FileSystemConsistent" +) + +func PossibleValuesForConsistencyModeTypes() []string { + return []string{ + string(ConsistencyModeTypesApplicationConsistent), + string(ConsistencyModeTypesCrashConsistent), + string(ConsistencyModeTypesFileSystemConsistent), + } +} + +func (s *ConsistencyModeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConsistencyModeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConsistencyModeTypes(input string) (*ConsistencyModeTypes, error) { + vals := map[string]ConsistencyModeTypes{ + "applicationconsistent": ConsistencyModeTypesApplicationConsistent, + "crashconsistent": ConsistencyModeTypesCrashConsistent, + "filesystemconsistent": ConsistencyModeTypesFileSystemConsistent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConsistencyModeTypes(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type OperatingSystemType string + +const ( + OperatingSystemTypeLinux OperatingSystemType = "Linux" + OperatingSystemTypeWindows OperatingSystemType = "Windows" +) + +func PossibleValuesForOperatingSystemType() []string { + return []string{ + string(OperatingSystemTypeLinux), + string(OperatingSystemTypeWindows), + } +} + +func (s *OperatingSystemType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemType(input string) (*OperatingSystemType, error) { + vals := map[string]OperatingSystemType{ + "linux": OperatingSystemTypeLinux, + "windows": OperatingSystemTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemType(input) + return &out, nil +} + +type PassNames string + +const ( + PassNamesOobeSystem PassNames = "OobeSystem" +) + +func PossibleValuesForPassNames() []string { + return []string{ + string(PassNamesOobeSystem), + } +} + +func (s *PassNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassNames(input string) (*PassNames, error) { + vals := map[string]PassNames{ + "oobesystem": PassNamesOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassNames(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type RestorePointCollectionExpandOptions string + +const ( + RestorePointCollectionExpandOptionsRestorePoints RestorePointCollectionExpandOptions = "restorePoints" +) + +func PossibleValuesForRestorePointCollectionExpandOptions() []string { + return []string{ + string(RestorePointCollectionExpandOptionsRestorePoints), + } +} + +func (s *RestorePointCollectionExpandOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointCollectionExpandOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointCollectionExpandOptions(input string) (*RestorePointCollectionExpandOptions, error) { + vals := map[string]RestorePointCollectionExpandOptions{ + "restorepoints": RestorePointCollectionExpandOptionsRestorePoints, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointCollectionExpandOptions(input) + return &out, nil +} + +type RestorePointEncryptionType string + +const ( + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey RestorePointEncryptionType = "EncryptionAtRestWithCustomerKey" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys RestorePointEncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey RestorePointEncryptionType = "EncryptionAtRestWithPlatformKey" +) + +func PossibleValuesForRestorePointEncryptionType() []string { + return []string{ + string(RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey), + } +} + +func (s *RestorePointEncryptionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointEncryptionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointEncryptionType(input string) (*RestorePointEncryptionType, error) { + vals := map[string]RestorePointEncryptionType{ + "encryptionatrestwithcustomerkey": RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey, + "encryptionatrestwithplatformandcustomerkeys": RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + "encryptionatrestwithplatformkey": RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointEncryptionType(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection.go b/resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection.go new file mode 100644 index 00000000000..91fd3012fb1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection.go @@ -0,0 +1,130 @@ +package restorepointcollections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RestorePointCollectionId{}) +} + +var _ resourceids.ResourceId = &RestorePointCollectionId{} + +// RestorePointCollectionId is a struct representing the Resource ID for a Restore Point Collection +type RestorePointCollectionId struct { + SubscriptionId string + ResourceGroupName string + RestorePointCollectionName string +} + +// NewRestorePointCollectionID returns a new RestorePointCollectionId struct +func NewRestorePointCollectionID(subscriptionId string, resourceGroupName string, restorePointCollectionName string) RestorePointCollectionId { + return RestorePointCollectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RestorePointCollectionName: restorePointCollectionName, + } +} + +// ParseRestorePointCollectionID parses 'input' into a RestorePointCollectionId +func ParseRestorePointCollectionID(input string) (*RestorePointCollectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointCollectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointCollectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRestorePointCollectionIDInsensitively parses 'input' case-insensitively into a RestorePointCollectionId +// note: this method should only be used for API response data and not user input +func ParseRestorePointCollectionIDInsensitively(input string) (*RestorePointCollectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointCollectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointCollectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointCollectionId) 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.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) + } + + return nil +} + +// ValidateRestorePointCollectionID checks that 'input' can be parsed as a Restore Point Collection ID +func ValidateRestorePointCollectionID(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 := ParseRestorePointCollectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Restore Point Collection ID +func (id RestorePointCollectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/restorePointCollections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RestorePointCollectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Restore Point Collection ID +func (id RestorePointCollectionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticRestorePointCollections", "restorePointCollections", "restorePointCollections"), + resourceids.UserSpecifiedSegment("restorePointCollectionName", "restorePointCollectionName"), + } +} + +// String returns a human-readable description of this Restore Point Collection ID +func (id RestorePointCollectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Restore Point Collection Name: %q", id.RestorePointCollectionName), + } + return fmt.Sprintf("Restore Point Collection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection_test.go b/resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection_test.go new file mode 100644 index 00000000000..bc01554f0be --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/id_restorepointcollection_test.go @@ -0,0 +1,282 @@ +package restorepointcollections + +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 = &RestorePointCollectionId{} + +func TestNewRestorePointCollectionID(t *testing.T) { + id := NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName") + + 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.RestorePointCollectionName != "restorePointCollectionName" { + t.Fatalf("Expected %q but got %q for Segment 'RestorePointCollectionName'", id.RestorePointCollectionName, "restorePointCollectionName") + } +} + +func TestFormatRestorePointCollectionID(t *testing.T) { + actual := NewRestorePointCollectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRestorePointCollectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointCollectionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Expected: &RestorePointCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointCollectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + } +} + +func TestParseRestorePointCollectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointCollectionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Expected: &RestorePointCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE", + Expected: &RestorePointCollectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RestorePointCollectionName: "rEsToRePoInTcOlLeCtIoNnAmE", + }, + }, + { + // 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.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointCollectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + } +} + +func TestSegmentsForRestorePointCollectionId(t *testing.T) { + segments := RestorePointCollectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RestorePointCollectionId 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/compute/2024-11-01/restorepointcollections/method_createorupdate.go b/resource-manager/compute/2024-11-01/restorepointcollections/method_createorupdate.go new file mode 100644 index 00000000000..7e9dac346e3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/method_createorupdate.go @@ -0,0 +1,58 @@ +package restorepointcollections + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RestorePointCollection +} + +// CreateOrUpdate ... +func (c RestorePointCollectionsClient) CreateOrUpdate(ctx context.Context, id RestorePointCollectionId, input RestorePointCollection) (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 + } + + var model RestorePointCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/method_delete.go b/resource-manager/compute/2024-11-01/restorepointcollections/method_delete.go new file mode 100644 index 00000000000..3aefb2adc43 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/method_delete.go @@ -0,0 +1,71 @@ +package restorepointcollections + +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 RestorePointCollectionsClient) Delete(ctx context.Context, id RestorePointCollectionId) (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 RestorePointCollectionsClient) DeleteThenPoll(ctx context.Context, id RestorePointCollectionId) 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/compute/2024-11-01/restorepointcollections/method_get.go b/resource-manager/compute/2024-11-01/restorepointcollections/method_get.go new file mode 100644 index 00000000000..636041d46c6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/method_get.go @@ -0,0 +1,83 @@ +package restorepointcollections + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RestorePointCollection +} + +type GetOperationOptions struct { + Expand *RestorePointCollectionExpandOptions +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c RestorePointCollectionsClient) Get(ctx context.Context, id RestorePointCollectionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RestorePointCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/method_list.go b/resource-manager/compute/2024-11-01/restorepointcollections/method_list.go new file mode 100644 index 00000000000..ab48c476888 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/method_list.go @@ -0,0 +1,106 @@ +package restorepointcollections + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RestorePointCollection +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []RestorePointCollection +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c RestorePointCollectionsClient) List(ctx context.Context, id commonids.ResourceGroupId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/restorePointCollections", 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 *[]RestorePointCollection `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 RestorePointCollectionsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RestorePointCollectionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RestorePointCollectionsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate RestorePointCollectionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]RestorePointCollection, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/method_listall.go b/resource-manager/compute/2024-11-01/restorepointcollections/method_listall.go new file mode 100644 index 00000000000..a254de39170 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/method_listall.go @@ -0,0 +1,106 @@ +package restorepointcollections + +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 ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]RestorePointCollection +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []RestorePointCollection +} + +type ListAllCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAllCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAll ... +func (c RestorePointCollectionsClient) ListAll(ctx context.Context, id commonids.SubscriptionId) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAllCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/restorePointCollections", 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 *[]RestorePointCollection `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c RestorePointCollectionsClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, RestorePointCollectionOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c RestorePointCollectionsClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate RestorePointCollectionOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]RestorePointCollection, 0) + + resp, err := c.ListAll(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/method_update.go b/resource-manager/compute/2024-11-01/restorepointcollections/method_update.go new file mode 100644 index 00000000000..3aa41ed97ea --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/method_update.go @@ -0,0 +1,57 @@ +package restorepointcollections + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RestorePointCollection +} + +// Update ... +func (c RestorePointCollectionsClient) Update(ctx context.Context, id RestorePointCollectionId, input RestorePointCollectionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model RestorePointCollection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_additionalunattendcontent.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_additionalunattendcontent.go new file mode 100644 index 00000000000..a60a8371ab2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentNames `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassNames `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_apientityreference.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_apientityreference.go new file mode 100644 index 00000000000..727d790c656 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_apientityreference.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_bootdiagnostics.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_bootdiagnostics.go new file mode 100644 index 00000000000..f7688478a5f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_diagnosticsprofile.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_diagnosticsprofile.go new file mode 100644 index 00000000000..0fe48b89ced --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_diskencryptionsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskencryptionsettings.go new file mode 100644 index 00000000000..0d821506598 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointattributes.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointattributes.go new file mode 100644 index 00000000000..43124c8f061 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointattributes.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointAttributes struct { + Encryption *RestorePointEncryption `json:"encryption,omitempty"` + Id *string `json:"id,omitempty"` + SourceDiskRestorePoint *ApiEntityReference `json:"sourceDiskRestorePoint,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointinstanceview.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointinstanceview.go new file mode 100644 index 00000000000..210aa74b823 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointinstanceview.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointInstanceView struct { + Id *string `json:"id,omitempty"` + ReplicationStatus *DiskRestorePointReplicationStatus `json:"replicationStatus,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointreplicationstatus.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointreplicationstatus.go new file mode 100644 index 00000000000..a9b1c99fc37 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_diskrestorepointreplicationstatus.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointReplicationStatus struct { + CompletionPercent *int64 `json:"completionPercent,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_encryptionidentity.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_encryptionidentity.go new file mode 100644 index 00000000000..ff6228b54ee --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// 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 { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_hardwareprofile.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_hardwareprofile.go new file mode 100644 index 00000000000..2d11fed2803 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_hostendpointsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_hostendpointsettings.go new file mode 100644 index 00000000000..e562bd67338 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_instanceviewstatus.go new file mode 100644 index 00000000000..c72457c65f6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package restorepointcollections + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultkeyreference.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..e67b885cbec --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..f403c9277b7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxconfiguration.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxconfiguration.go new file mode 100644 index 00000000000..331ab8adf5f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxpatchsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxpatchsettings.go new file mode 100644 index 00000000000..1911d1f34cb --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..ee79a6f5155 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_manageddiskparameters.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_manageddiskparameters.go new file mode 100644 index 00000000000..c5ceac9dcb8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_osprofile.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_osprofile.go new file mode 100644 index 00000000000..2a8765dd51f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_osprofile.go @@ -0,0 +1,16 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_patchsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_patchsettings.go new file mode 100644 index 00000000000..dccbe861dcc --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_patchsettings.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_proxyagentsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_proxyagentsettings.go new file mode 100644 index 00000000000..7e25b0870de --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_proxyagentsettings.go @@ -0,0 +1,12 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepoint.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepoint.go new file mode 100644 index 00000000000..4d1f4152a43 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepoint.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RestorePointProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollection.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollection.go new file mode 100644 index 00000000000..cb0993cc4ee --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollection.go @@ -0,0 +1,13 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollection struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *RestorePointCollectionProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionproperties.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionproperties.go new file mode 100644 index 00000000000..9d6edb62a22 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionproperties.go @@ -0,0 +1,11 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionProperties struct { + ProvisioningState *string `json:"provisioningState,omitempty"` + RestorePointCollectionId *string `json:"restorePointCollectionId,omitempty"` + RestorePoints *[]RestorePoint `json:"restorePoints,omitempty"` + Source *RestorePointCollectionSourceProperties `json:"source,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionsourceproperties.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionsourceproperties.go new file mode 100644 index 00000000000..0fce692d38b --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionsourceproperties.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionSourceProperties struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionupdate.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionupdate.go new file mode 100644 index 00000000000..e97da7d44a8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointcollectionupdate.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionUpdate struct { + Properties *RestorePointCollectionProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointencryption.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointencryption.go new file mode 100644 index 00000000000..ac434a73886 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointencryption.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointEncryption struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Type *RestorePointEncryptionType `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointinstanceview.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointinstanceview.go new file mode 100644 index 00000000000..50af16f9dd0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointinstanceview.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointInstanceView struct { + DiskRestorePoints *[]DiskRestorePointInstanceView `json:"diskRestorePoints,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointproperties.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointproperties.go new file mode 100644 index 00000000000..083437b0943 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointproperties.go @@ -0,0 +1,32 @@ +package restorepointcollections + +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 RestorePointProperties struct { + ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty"` + ExcludeDisks *[]ApiEntityReference `json:"excludeDisks,omitempty"` + InstanceView *RestorePointInstanceView `json:"instanceView,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty"` + SourceRestorePoint *ApiEntityReference `json:"sourceRestorePoint,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` +} + +func (o *RestorePointProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *RestorePointProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcemetadata.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcemetadata.go new file mode 100644 index 00000000000..154a3e68682 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcemetadata.go @@ -0,0 +1,17 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceMetadata struct { + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + Location *string `json:"location,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *RestorePointSourceVMStorageProfile `json:"storageProfile,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmdatadisk.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmdatadisk.go new file mode 100644 index 00000000000..587b86f3ae1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmdatadisk.go @@ -0,0 +1,14 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun *int64 `json:"lun,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmosdisk.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmosdisk.go new file mode 100644 index 00000000000..e75634d6f6f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmosdisk.go @@ -0,0 +1,15 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemType `json:"osType,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go new file mode 100644 index 00000000000..101439cc548 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_restorepointsourcevmstorageprofile.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMStorageProfile struct { + DataDisks *[]RestorePointSourceVMDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + OsDisk *RestorePointSourceVMOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_securityprofile.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_securityprofile.go new file mode 100644 index 00000000000..32d20891ded --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_securityprofile.go @@ -0,0 +1,12 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_sshconfiguration.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_sshconfiguration.go new file mode 100644 index 00000000000..78c9da8533f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_sshpublickey.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_sshpublickey.go new file mode 100644 index 00000000000..e2950536919 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_sshpublickey.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_subresource.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_subresource.go new file mode 100644 index 00000000000..bd10eea4e51 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_subresource.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_uefisettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_uefisettings.go new file mode 100644 index 00000000000..12510ee841d --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_uefisettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_vaultcertificate.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_vaultcertificate.go new file mode 100644 index 00000000000..f3fd244ab96 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_vaultsecretgroup.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_vaultsecretgroup.go new file mode 100644 index 00000000000..039fc20fb7e --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_vmdisksecurityprofile.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..af2b07bc05c --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_vmsizeproperties.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_vmsizeproperties.go new file mode 100644 index 00000000000..9bd6823b54e --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_windowsconfiguration.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_windowsconfiguration.go new file mode 100644 index 00000000000..1408c9770a1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..a2b5f7d65b6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_winrmconfiguration.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_winrmconfiguration.go new file mode 100644 index 00000000000..d89758ef38f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/model_winrmlistener.go b/resource-manager/compute/2024-11-01/restorepointcollections/model_winrmlistener.go new file mode 100644 index 00000000000..3b6dcd5d775 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/model_winrmlistener.go @@ -0,0 +1,9 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepointcollections/predicates.go b/resource-manager/compute/2024-11-01/restorepointcollections/predicates.go new file mode 100644 index 00000000000..6f4eb007a65 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/predicates.go @@ -0,0 +1,32 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointCollectionOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p RestorePointCollectionOperationPredicate) Matches(input RestorePointCollection) 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/compute/2024-11-01/restorepointcollections/version.go b/resource-manager/compute/2024-11-01/restorepointcollections/version.go new file mode 100644 index 00000000000..9bc2791ac55 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepointcollections/version.go @@ -0,0 +1,10 @@ +package restorepointcollections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/restorepointcollections/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/README.md b/resource-manager/compute/2024-11-01/restorepoints/README.md new file mode 100644 index 00000000000..67b43436252 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/README.md @@ -0,0 +1,65 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/restorepoints` Documentation + +The `restorepoints` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/restorepoints" +``` + + +### Client Initialization + +```go +client := restorepoints.NewRestorePointsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `RestorePointsClient.Create` + +```go +ctx := context.TODO() +id := restorepoints.NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + +payload := restorepoints.RestorePoint{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `RestorePointsClient.Delete` + +```go +ctx := context.TODO() +id := restorepoints.NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `RestorePointsClient.Get` + +```go +ctx := context.TODO() +id := restorepoints.NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + +read, err := client.Get(ctx, id, restorepoints.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/restorepoints/client.go b/resource-manager/compute/2024-11-01/restorepoints/client.go new file mode 100644 index 00000000000..febed9d42f1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/client.go @@ -0,0 +1,26 @@ +package restorepoints + +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 RestorePointsClient struct { + Client *resourcemanager.Client +} + +func NewRestorePointsClientWithBaseURI(sdkApi sdkEnv.Api) (*RestorePointsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "restorepoints", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating RestorePointsClient: %+v", err) + } + + return &RestorePointsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/constants.go b/resource-manager/compute/2024-11-01/restorepoints/constants.go new file mode 100644 index 00000000000..b6c5901eff0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/constants.go @@ -0,0 +1,1525 @@ +package restorepoints + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentNames string + +const ( + ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentNames() []string { + return []string{ + string(ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentNames(input string) (*ComponentNames, error) { + vals := map[string]ComponentNames{ + "microsoft-windows-shell-setup": ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentNames(input) + return &out, nil +} + +type ConsistencyModeTypes string + +const ( + ConsistencyModeTypesApplicationConsistent ConsistencyModeTypes = "ApplicationConsistent" + ConsistencyModeTypesCrashConsistent ConsistencyModeTypes = "CrashConsistent" + ConsistencyModeTypesFileSystemConsistent ConsistencyModeTypes = "FileSystemConsistent" +) + +func PossibleValuesForConsistencyModeTypes() []string { + return []string{ + string(ConsistencyModeTypesApplicationConsistent), + string(ConsistencyModeTypesCrashConsistent), + string(ConsistencyModeTypesFileSystemConsistent), + } +} + +func (s *ConsistencyModeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseConsistencyModeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseConsistencyModeTypes(input string) (*ConsistencyModeTypes, error) { + vals := map[string]ConsistencyModeTypes{ + "applicationconsistent": ConsistencyModeTypesApplicationConsistent, + "crashconsistent": ConsistencyModeTypesCrashConsistent, + "filesystemconsistent": ConsistencyModeTypesFileSystemConsistent, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ConsistencyModeTypes(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type OperatingSystemType string + +const ( + OperatingSystemTypeLinux OperatingSystemType = "Linux" + OperatingSystemTypeWindows OperatingSystemType = "Windows" +) + +func PossibleValuesForOperatingSystemType() []string { + return []string{ + string(OperatingSystemTypeLinux), + string(OperatingSystemTypeWindows), + } +} + +func (s *OperatingSystemType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemType(input string) (*OperatingSystemType, error) { + vals := map[string]OperatingSystemType{ + "linux": OperatingSystemTypeLinux, + "windows": OperatingSystemTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemType(input) + return &out, nil +} + +type PassNames string + +const ( + PassNamesOobeSystem PassNames = "OobeSystem" +) + +func PossibleValuesForPassNames() []string { + return []string{ + string(PassNamesOobeSystem), + } +} + +func (s *PassNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassNames(input string) (*PassNames, error) { + vals := map[string]PassNames{ + "oobesystem": PassNamesOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassNames(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type RestorePointEncryptionType string + +const ( + RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey RestorePointEncryptionType = "EncryptionAtRestWithCustomerKey" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys RestorePointEncryptionType = "EncryptionAtRestWithPlatformAndCustomerKeys" + RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey RestorePointEncryptionType = "EncryptionAtRestWithPlatformKey" +) + +func PossibleValuesForRestorePointEncryptionType() []string { + return []string{ + string(RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys), + string(RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey), + } +} + +func (s *RestorePointEncryptionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointEncryptionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointEncryptionType(input string) (*RestorePointEncryptionType, error) { + vals := map[string]RestorePointEncryptionType{ + "encryptionatrestwithcustomerkey": RestorePointEncryptionTypeEncryptionAtRestWithCustomerKey, + "encryptionatrestwithplatformandcustomerkeys": RestorePointEncryptionTypeEncryptionAtRestWithPlatformAndCustomerKeys, + "encryptionatrestwithplatformkey": RestorePointEncryptionTypeEncryptionAtRestWithPlatformKey, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointEncryptionType(input) + return &out, nil +} + +type RestorePointExpandOptions string + +const ( + RestorePointExpandOptionsInstanceView RestorePointExpandOptions = "instanceView" +) + +func PossibleValuesForRestorePointExpandOptions() []string { + return []string{ + string(RestorePointExpandOptionsInstanceView), + } +} + +func (s *RestorePointExpandOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRestorePointExpandOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRestorePointExpandOptions(input string) (*RestorePointExpandOptions, error) { + vals := map[string]RestorePointExpandOptions{ + "instanceview": RestorePointExpandOptionsInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RestorePointExpandOptions(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/id_restorepoint.go b/resource-manager/compute/2024-11-01/restorepoints/id_restorepoint.go new file mode 100644 index 00000000000..5644a05c4f4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/id_restorepoint.go @@ -0,0 +1,139 @@ +package restorepoints + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RestorePointId{}) +} + +var _ resourceids.ResourceId = &RestorePointId{} + +// RestorePointId is a struct representing the Resource ID for a Restore Point +type RestorePointId struct { + SubscriptionId string + ResourceGroupName string + RestorePointCollectionName string + RestorePointName string +} + +// NewRestorePointID returns a new RestorePointId struct +func NewRestorePointID(subscriptionId string, resourceGroupName string, restorePointCollectionName string, restorePointName string) RestorePointId { + return RestorePointId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + RestorePointCollectionName: restorePointCollectionName, + RestorePointName: restorePointName, + } +} + +// ParseRestorePointID parses 'input' into a RestorePointId +func ParseRestorePointID(input string) (*RestorePointId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRestorePointIDInsensitively parses 'input' case-insensitively into a RestorePointId +// note: this method should only be used for API response data and not user input +func ParseRestorePointIDInsensitively(input string) (*RestorePointId, error) { + parser := resourceids.NewParserFromResourceIdType(&RestorePointId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RestorePointId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RestorePointId) 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.RestorePointCollectionName, ok = input.Parsed["restorePointCollectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointCollectionName", input) + } + + if id.RestorePointName, ok = input.Parsed["restorePointName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "restorePointName", input) + } + + return nil +} + +// ValidateRestorePointID checks that 'input' can be parsed as a Restore Point ID +func ValidateRestorePointID(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 := ParseRestorePointID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Restore Point ID +func (id RestorePointId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/restorePointCollections/%s/restorePoints/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.RestorePointCollectionName, id.RestorePointName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Restore Point ID +func (id RestorePointId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticRestorePointCollections", "restorePointCollections", "restorePointCollections"), + resourceids.UserSpecifiedSegment("restorePointCollectionName", "restorePointCollectionName"), + resourceids.StaticSegment("staticRestorePoints", "restorePoints", "restorePoints"), + resourceids.UserSpecifiedSegment("restorePointName", "restorePointName"), + } +} + +// String returns a human-readable description of this Restore Point ID +func (id RestorePointId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Restore Point Collection Name: %q", id.RestorePointCollectionName), + fmt.Sprintf("Restore Point Name: %q", id.RestorePointName), + } + return fmt.Sprintf("Restore Point (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/id_restorepoint_test.go b/resource-manager/compute/2024-11-01/restorepoints/id_restorepoint_test.go new file mode 100644 index 00000000000..ea64d98dc47 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/id_restorepoint_test.go @@ -0,0 +1,327 @@ +package restorepoints + +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 = &RestorePointId{} + +func TestNewRestorePointID(t *testing.T) { + id := NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName") + + 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.RestorePointCollectionName != "restorePointCollectionName" { + t.Fatalf("Expected %q but got %q for Segment 'RestorePointCollectionName'", id.RestorePointCollectionName, "restorePointCollectionName") + } + + if id.RestorePointName != "restorePointName" { + t.Fatalf("Expected %q but got %q for Segment 'RestorePointName'", id.RestorePointName, "restorePointName") + } +} + +func TestFormatRestorePointID(t *testing.T) { + actual := NewRestorePointID("12345678-1234-9876-4563-123456789012", "example-resource-group", "restorePointCollectionName", "restorePointName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRestorePointID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName", + Expected: &RestorePointId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + RestorePointName: "restorePointName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + if actual.RestorePointName != v.Expected.RestorePointName { + t.Fatalf("Expected %q but got %q for RestorePointName", v.Expected.RestorePointName, actual.RestorePointName) + } + + } +} + +func TestParseRestorePointIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RestorePointId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/rEsToRePoInTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName", + Expected: &RestorePointId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + RestorePointCollectionName: "restorePointCollectionName", + RestorePointName: "restorePointName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/restorePointCollections/restorePointCollectionName/restorePoints/restorePointName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/rEsToRePoInTs/rEsToRePoInTnAmE", + Expected: &RestorePointId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + RestorePointCollectionName: "rEsToRePoInTcOlLeCtIoNnAmE", + RestorePointName: "rEsToRePoInTnAmE", + }, + }, + { + // 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.cOmPuTe/rEsToRePoInTcOlLeCtIoNs/rEsToRePoInTcOlLeCtIoNnAmE/rEsToRePoInTs/rEsToRePoInTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRestorePointIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.RestorePointCollectionName != v.Expected.RestorePointCollectionName { + t.Fatalf("Expected %q but got %q for RestorePointCollectionName", v.Expected.RestorePointCollectionName, actual.RestorePointCollectionName) + } + + if actual.RestorePointName != v.Expected.RestorePointName { + t.Fatalf("Expected %q but got %q for RestorePointName", v.Expected.RestorePointName, actual.RestorePointName) + } + + } +} + +func TestSegmentsForRestorePointId(t *testing.T) { + segments := RestorePointId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RestorePointId 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/compute/2024-11-01/restorepoints/method_create.go b/resource-manager/compute/2024-11-01/restorepoints/method_create.go new file mode 100644 index 00000000000..25a29454e02 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/method_create.go @@ -0,0 +1,74 @@ +package restorepoints + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RestorePoint +} + +// Create ... +func (c RestorePointsClient) Create(ctx context.Context, id RestorePointId, input RestorePoint) (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 RestorePointsClient) CreateThenPoll(ctx context.Context, id RestorePointId, input RestorePoint) 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/compute/2024-11-01/restorepoints/method_delete.go b/resource-manager/compute/2024-11-01/restorepoints/method_delete.go new file mode 100644 index 00000000000..6830e37f87d --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/method_delete.go @@ -0,0 +1,71 @@ +package restorepoints + +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 RestorePointsClient) Delete(ctx context.Context, id RestorePointId) (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 RestorePointsClient) DeleteThenPoll(ctx context.Context, id RestorePointId) 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/compute/2024-11-01/restorepoints/method_get.go b/resource-manager/compute/2024-11-01/restorepoints/method_get.go new file mode 100644 index 00000000000..ccf229525cb --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/method_get.go @@ -0,0 +1,83 @@ +package restorepoints + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RestorePoint +} + +type GetOperationOptions struct { + Expand *RestorePointExpandOptions +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c RestorePointsClient) Get(ctx context.Context, id RestorePointId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RestorePoint + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_additionalunattendcontent.go b/resource-manager/compute/2024-11-01/restorepoints/model_additionalunattendcontent.go new file mode 100644 index 00000000000..efe1fa7be9d --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentNames `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassNames `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_apientityreference.go b/resource-manager/compute/2024-11-01/restorepoints/model_apientityreference.go new file mode 100644 index 00000000000..babd48c96f3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_apientityreference.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_bootdiagnostics.go b/resource-manager/compute/2024-11-01/restorepoints/model_bootdiagnostics.go new file mode 100644 index 00000000000..2504b8f2cd9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_diagnosticsprofile.go b/resource-manager/compute/2024-11-01/restorepoints/model_diagnosticsprofile.go new file mode 100644 index 00000000000..7da951f723e --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_diskencryptionsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_diskencryptionsettings.go new file mode 100644 index 00000000000..5fbbed53677 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointattributes.go b/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointattributes.go new file mode 100644 index 00000000000..22984929525 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointattributes.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointAttributes struct { + Encryption *RestorePointEncryption `json:"encryption,omitempty"` + Id *string `json:"id,omitempty"` + SourceDiskRestorePoint *ApiEntityReference `json:"sourceDiskRestorePoint,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointinstanceview.go b/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointinstanceview.go new file mode 100644 index 00000000000..a37f8c7ad70 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointinstanceview.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointInstanceView struct { + Id *string `json:"id,omitempty"` + ReplicationStatus *DiskRestorePointReplicationStatus `json:"replicationStatus,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointreplicationstatus.go b/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointreplicationstatus.go new file mode 100644 index 00000000000..40951229dac --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_diskrestorepointreplicationstatus.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskRestorePointReplicationStatus struct { + CompletionPercent *int64 `json:"completionPercent,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_encryptionidentity.go b/resource-manager/compute/2024-11-01/restorepoints/model_encryptionidentity.go new file mode 100644 index 00000000000..3d64c837abc --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package restorepoints + +// 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 { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_hardwareprofile.go b/resource-manager/compute/2024-11-01/restorepoints/model_hardwareprofile.go new file mode 100644 index 00000000000..6284b4bfbea --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_hostendpointsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_hostendpointsettings.go new file mode 100644 index 00000000000..e719148bc61 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/restorepoints/model_instanceviewstatus.go new file mode 100644 index 00000000000..bb4210653e0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package restorepoints + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_keyvaultkeyreference.go b/resource-manager/compute/2024-11-01/restorepoints/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..a84afc6404c --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/restorepoints/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..473adafc492 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_linuxconfiguration.go b/resource-manager/compute/2024-11-01/restorepoints/model_linuxconfiguration.go new file mode 100644 index 00000000000..c61f1ead4b8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_linuxpatchsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_linuxpatchsettings.go new file mode 100644 index 00000000000..4363078db3a --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..3ed5d0d1c14 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_manageddiskparameters.go b/resource-manager/compute/2024-11-01/restorepoints/model_manageddiskparameters.go new file mode 100644 index 00000000000..c60383cf664 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_osprofile.go b/resource-manager/compute/2024-11-01/restorepoints/model_osprofile.go new file mode 100644 index 00000000000..0bb7cb7670b --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_osprofile.go @@ -0,0 +1,16 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_patchsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_patchsettings.go new file mode 100644 index 00000000000..3e237d16e78 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_patchsettings.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_proxyagentsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_proxyagentsettings.go new file mode 100644 index 00000000000..f2ad69f3060 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_proxyagentsettings.go @@ -0,0 +1,12 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepoint.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepoint.go new file mode 100644 index 00000000000..e63d204278a --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepoint.go @@ -0,0 +1,11 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePoint struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *RestorePointProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointencryption.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointencryption.go new file mode 100644 index 00000000000..7c39e4aeb50 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointencryption.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointEncryption struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Type *RestorePointEncryptionType `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointinstanceview.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointinstanceview.go new file mode 100644 index 00000000000..d91bef8b2c7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointinstanceview.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointInstanceView struct { + DiskRestorePoints *[]DiskRestorePointInstanceView `json:"diskRestorePoints,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointproperties.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointproperties.go new file mode 100644 index 00000000000..f6dd4208a64 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointproperties.go @@ -0,0 +1,32 @@ +package restorepoints + +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 RestorePointProperties struct { + ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty"` + ExcludeDisks *[]ApiEntityReference `json:"excludeDisks,omitempty"` + InstanceView *RestorePointInstanceView `json:"instanceView,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + SourceMetadata *RestorePointSourceMetadata `json:"sourceMetadata,omitempty"` + SourceRestorePoint *ApiEntityReference `json:"sourceRestorePoint,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` +} + +func (o *RestorePointProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *RestorePointProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcemetadata.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcemetadata.go new file mode 100644 index 00000000000..4a71d34dcb1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcemetadata.go @@ -0,0 +1,17 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceMetadata struct { + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + Location *string `json:"location,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *RestorePointSourceVMStorageProfile `json:"storageProfile,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmdatadisk.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmdatadisk.go new file mode 100644 index 00000000000..846b38eea30 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmdatadisk.go @@ -0,0 +1,14 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun *int64 `json:"lun,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmosdisk.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmosdisk.go new file mode 100644 index 00000000000..f61bf9ba4f5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmosdisk.go @@ -0,0 +1,15 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DiskRestorePoint *DiskRestorePointAttributes `json:"diskRestorePoint,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemType `json:"osType,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmstorageprofile.go b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmstorageprofile.go new file mode 100644 index 00000000000..6122c5ab170 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_restorepointsourcevmstorageprofile.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RestorePointSourceVMStorageProfile struct { + DataDisks *[]RestorePointSourceVMDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + OsDisk *RestorePointSourceVMOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_securityprofile.go b/resource-manager/compute/2024-11-01/restorepoints/model_securityprofile.go new file mode 100644 index 00000000000..944bde89038 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_securityprofile.go @@ -0,0 +1,12 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_sshconfiguration.go b/resource-manager/compute/2024-11-01/restorepoints/model_sshconfiguration.go new file mode 100644 index 00000000000..af61ff07f8f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_sshpublickey.go b/resource-manager/compute/2024-11-01/restorepoints/model_sshpublickey.go new file mode 100644 index 00000000000..3f9651d567c --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_sshpublickey.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_subresource.go b/resource-manager/compute/2024-11-01/restorepoints/model_subresource.go new file mode 100644 index 00000000000..a2e5c085ec2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_subresource.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_uefisettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_uefisettings.go new file mode 100644 index 00000000000..9878e8a1f4b --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_uefisettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_vaultcertificate.go b/resource-manager/compute/2024-11-01/restorepoints/model_vaultcertificate.go new file mode 100644 index 00000000000..7ace154164b --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_vaultsecretgroup.go b/resource-manager/compute/2024-11-01/restorepoints/model_vaultsecretgroup.go new file mode 100644 index 00000000000..04d2ed6ef06 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_vmdisksecurityprofile.go b/resource-manager/compute/2024-11-01/restorepoints/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..bdf4f1b0785 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_vmsizeproperties.go b/resource-manager/compute/2024-11-01/restorepoints/model_vmsizeproperties.go new file mode 100644 index 00000000000..5e877d0f4d5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_windowsconfiguration.go b/resource-manager/compute/2024-11-01/restorepoints/model_windowsconfiguration.go new file mode 100644 index 00000000000..8260015420f --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..4a654678566 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_winrmconfiguration.go b/resource-manager/compute/2024-11-01/restorepoints/model_winrmconfiguration.go new file mode 100644 index 00000000000..09a7b12f0d3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/model_winrmlistener.go b/resource-manager/compute/2024-11-01/restorepoints/model_winrmlistener.go new file mode 100644 index 00000000000..7d06a9d1480 --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/model_winrmlistener.go @@ -0,0 +1,9 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/restorepoints/version.go b/resource-manager/compute/2024-11-01/restorepoints/version.go new file mode 100644 index 00000000000..1fbbd9c03fb --- /dev/null +++ b/resource-manager/compute/2024-11-01/restorepoints/version.go @@ -0,0 +1,10 @@ +package restorepoints + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/restorepoints/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/README.md b/resource-manager/compute/2024-11-01/sshpublickeys/README.md new file mode 100644 index 00000000000..b637c6e033f --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/README.md @@ -0,0 +1,150 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/sshpublickeys` Documentation + +The `sshpublickeys` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/sshpublickeys" +``` + + +### Client Initialization + +```go +client := sshpublickeys.NewSshPublicKeysClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `SshPublicKeysClient.Create` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +payload := sshpublickeys.SshPublicKeyResource{ + // ... +} + + +read, err := client.Create(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.Delete` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.GenerateKeyPair` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +payload := sshpublickeys.SshGenerateKeyPairInputParameters{ + // ... +} + + +read, err := client.GenerateKeyPair(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `SshPublicKeysClient.Get` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +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: `SshPublicKeysClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SshPublicKeysClient.ListBySubscription` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListBySubscription(ctx, id)` can be used to do batched pagination +items, err := client.ListBySubscriptionComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `SshPublicKeysClient.Update` + +```go +ctx := context.TODO() +id := sshpublickeys.NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + +payload := sshpublickeys.SshPublicKeyUpdateResource{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/client.go b/resource-manager/compute/2024-11-01/sshpublickeys/client.go new file mode 100644 index 00000000000..b1945fe3975 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/client.go @@ -0,0 +1,26 @@ +package sshpublickeys + +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 SshPublicKeysClient struct { + Client *resourcemanager.Client +} + +func NewSshPublicKeysClientWithBaseURI(sdkApi sdkEnv.Api) (*SshPublicKeysClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "sshpublickeys", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating SshPublicKeysClient: %+v", err) + } + + return &SshPublicKeysClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/constants.go b/resource-manager/compute/2024-11-01/sshpublickeys/constants.go new file mode 100644 index 00000000000..81d9eb1b3af --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/constants.go @@ -0,0 +1,51 @@ +package sshpublickeys + +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 SshEncryptionTypes string + +const ( + SshEncryptionTypesEdTwoFiveFiveOneNine SshEncryptionTypes = "Ed25519" + SshEncryptionTypesRSA SshEncryptionTypes = "RSA" +) + +func PossibleValuesForSshEncryptionTypes() []string { + return []string{ + string(SshEncryptionTypesEdTwoFiveFiveOneNine), + string(SshEncryptionTypesRSA), + } +} + +func (s *SshEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSshEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSshEncryptionTypes(input string) (*SshEncryptionTypes, error) { + vals := map[string]SshEncryptionTypes{ + "ed25519": SshEncryptionTypesEdTwoFiveFiveOneNine, + "rsa": SshEncryptionTypesRSA, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SshEncryptionTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey.go b/resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey.go new file mode 100644 index 00000000000..87079874645 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey.go @@ -0,0 +1,130 @@ +package sshpublickeys + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&SshPublicKeyId{}) +} + +var _ resourceids.ResourceId = &SshPublicKeyId{} + +// SshPublicKeyId is a struct representing the Resource ID for a Ssh Public Key +type SshPublicKeyId struct { + SubscriptionId string + ResourceGroupName string + SshPublicKeyName string +} + +// NewSshPublicKeyID returns a new SshPublicKeyId struct +func NewSshPublicKeyID(subscriptionId string, resourceGroupName string, sshPublicKeyName string) SshPublicKeyId { + return SshPublicKeyId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + SshPublicKeyName: sshPublicKeyName, + } +} + +// ParseSshPublicKeyID parses 'input' into a SshPublicKeyId +func ParseSshPublicKeyID(input string) (*SshPublicKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(&SshPublicKeyId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SshPublicKeyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSshPublicKeyIDInsensitively parses 'input' case-insensitively into a SshPublicKeyId +// note: this method should only be used for API response data and not user input +func ParseSshPublicKeyIDInsensitively(input string) (*SshPublicKeyId, error) { + parser := resourceids.NewParserFromResourceIdType(&SshPublicKeyId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SshPublicKeyId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SshPublicKeyId) 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.SshPublicKeyName, ok = input.Parsed["sshPublicKeyName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "sshPublicKeyName", input) + } + + return nil +} + +// ValidateSshPublicKeyID checks that 'input' can be parsed as a Ssh Public Key ID +func ValidateSshPublicKeyID(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 := ParseSshPublicKeyID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Ssh Public Key ID +func (id SshPublicKeyId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/sshPublicKeys/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.SshPublicKeyName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Ssh Public Key ID +func (id SshPublicKeyId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticSshPublicKeys", "sshPublicKeys", "sshPublicKeys"), + resourceids.UserSpecifiedSegment("sshPublicKeyName", "sshPublicKeyName"), + } +} + +// String returns a human-readable description of this Ssh Public Key ID +func (id SshPublicKeyId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Ssh Public Key Name: %q", id.SshPublicKeyName), + } + return fmt.Sprintf("Ssh Public Key (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey_test.go b/resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey_test.go new file mode 100644 index 00000000000..841313c1e35 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/id_sshpublickey_test.go @@ -0,0 +1,282 @@ +package sshpublickeys + +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 = &SshPublicKeyId{} + +func TestNewSshPublicKeyID(t *testing.T) { + id := NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName") + + 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.SshPublicKeyName != "sshPublicKeyName" { + t.Fatalf("Expected %q but got %q for Segment 'SshPublicKeyName'", id.SshPublicKeyName, "sshPublicKeyName") + } +} + +func TestFormatSshPublicKeyID(t *testing.T) { + actual := NewSshPublicKeyID("12345678-1234-9876-4563-123456789012", "example-resource-group", "sshPublicKeyName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSshPublicKeyID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SshPublicKeyId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName", + Expected: &SshPublicKeyId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SshPublicKeyName: "sshPublicKeyName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSshPublicKeyID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.SshPublicKeyName != v.Expected.SshPublicKeyName { + t.Fatalf("Expected %q but got %q for SshPublicKeyName", v.Expected.SshPublicKeyName, actual.SshPublicKeyName) + } + + } +} + +func TestParseSshPublicKeyIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SshPublicKeyId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/sShPuBlIcKeYs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName", + Expected: &SshPublicKeyId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + SshPublicKeyName: "sshPublicKeyName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/sshPublicKeys/sshPublicKeyName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/sShPuBlIcKeYs/sShPuBlIcKeYnAmE", + Expected: &SshPublicKeyId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + SshPublicKeyName: "sShPuBlIcKeYnAmE", + }, + }, + { + // 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.cOmPuTe/sShPuBlIcKeYs/sShPuBlIcKeYnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSshPublicKeyIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.SshPublicKeyName != v.Expected.SshPublicKeyName { + t.Fatalf("Expected %q but got %q for SshPublicKeyName", v.Expected.SshPublicKeyName, actual.SshPublicKeyName) + } + + } +} + +func TestSegmentsForSshPublicKeyId(t *testing.T) { + segments := SshPublicKeyId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SshPublicKeyId 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/compute/2024-11-01/sshpublickeys/method_create.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_create.go new file mode 100644 index 00000000000..d348c2924e1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_create.go @@ -0,0 +1,58 @@ +package sshpublickeys + +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 CreateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyResource +} + +// Create ... +func (c SshPublicKeysClient) Create(ctx context.Context, id SshPublicKeyId, input SshPublicKeyResource) (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 + } + + var model SshPublicKeyResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/method_delete.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_delete.go new file mode 100644 index 00000000000..ee58be34e07 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_delete.go @@ -0,0 +1,47 @@ +package sshpublickeys + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c SshPublicKeysClient) Delete(ctx context.Context, id SshPublicKeyId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/method_generatekeypair.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_generatekeypair.go new file mode 100644 index 00000000000..d0a6f830ed0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_generatekeypair.go @@ -0,0 +1,58 @@ +package sshpublickeys + +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 GenerateKeyPairOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyGenerateKeyPairResult +} + +// GenerateKeyPair ... +func (c SshPublicKeysClient) GenerateKeyPair(ctx context.Context, id SshPublicKeyId, input SshGenerateKeyPairInputParameters) (result GenerateKeyPairOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateKeyPair", 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 + } + + var model SshPublicKeyGenerateKeyPairResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/method_get.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_get.go new file mode 100644 index 00000000000..dc1c3cbdb02 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_get.go @@ -0,0 +1,53 @@ +package sshpublickeys + +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 *SshPublicKeyResource +} + +// Get ... +func (c SshPublicKeysClient) Get(ctx context.Context, id SshPublicKeyId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model SshPublicKeyResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/method_listbyresourcegroup.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_listbyresourcegroup.go new file mode 100644 index 00000000000..506f8a33cd3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package sshpublickeys + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SshPublicKeyResource +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []SshPublicKeyResource +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c SshPublicKeysClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/sshPublicKeys", 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 *[]SshPublicKeyResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c SshPublicKeysClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, SshPublicKeyResourceOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SshPublicKeysClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate SshPublicKeyResourceOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]SshPublicKeyResource, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/method_listbysubscription.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_listbysubscription.go new file mode 100644 index 00000000000..60fe1490315 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_listbysubscription.go @@ -0,0 +1,106 @@ +package sshpublickeys + +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 ListBySubscriptionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]SshPublicKeyResource +} + +type ListBySubscriptionCompleteResult struct { + LatestHttpResponse *http.Response + Items []SshPublicKeyResource +} + +type ListBySubscriptionCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListBySubscriptionCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListBySubscription ... +func (c SshPublicKeysClient) ListBySubscription(ctx context.Context, id commonids.SubscriptionId) (result ListBySubscriptionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListBySubscriptionCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/sshPublicKeys", 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 *[]SshPublicKeyResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListBySubscriptionComplete retrieves all the results into a single object +func (c SshPublicKeysClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, SshPublicKeyResourceOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c SshPublicKeysClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate SshPublicKeyResourceOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]SshPublicKeyResource, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/method_update.go b/resource-manager/compute/2024-11-01/sshpublickeys/method_update.go new file mode 100644 index 00000000000..da0970a3389 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/method_update.go @@ -0,0 +1,57 @@ +package sshpublickeys + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *SshPublicKeyResource +} + +// Update ... +func (c SshPublicKeysClient) Update(ctx context.Context, id SshPublicKeyId, input SshPublicKeyUpdateResource) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model SshPublicKeyResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/model_sshgeneratekeypairinputparameters.go b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshgeneratekeypairinputparameters.go new file mode 100644 index 00000000000..9edecb3ad2f --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshgeneratekeypairinputparameters.go @@ -0,0 +1,8 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshGenerateKeyPairInputParameters struct { + EncryptionType *SshEncryptionTypes `json:"encryptionType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go new file mode 100644 index 00000000000..cf57d99b268 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeygeneratekeypairresult.go @@ -0,0 +1,10 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyGenerateKeyPairResult struct { + Id string `json:"id"` + PrivateKey string `json:"privateKey"` + PublicKey string `json:"publicKey"` +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresource.go b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresource.go new file mode 100644 index 00000000000..bbabaefed19 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresource.go @@ -0,0 +1,13 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResource struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *SshPublicKeyResourceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go new file mode 100644 index 00000000000..b1d00a16a12 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyresourceproperties.go @@ -0,0 +1,8 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResourceProperties struct { + PublicKey *string `json:"publicKey,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyupdateresource.go b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyupdateresource.go new file mode 100644 index 00000000000..e5ab89367c5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/model_sshpublickeyupdateresource.go @@ -0,0 +1,9 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyUpdateResource struct { + Properties *SshPublicKeyResourceProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/sshpublickeys/predicates.go b/resource-manager/compute/2024-11-01/sshpublickeys/predicates.go new file mode 100644 index 00000000000..eafbb4400ce --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/predicates.go @@ -0,0 +1,32 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKeyResourceOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p SshPublicKeyResourceOperationPredicate) Matches(input SshPublicKeyResource) 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/compute/2024-11-01/sshpublickeys/version.go b/resource-manager/compute/2024-11-01/sshpublickeys/version.go new file mode 100644 index 00000000000..d99bb238efc --- /dev/null +++ b/resource-manager/compute/2024-11-01/sshpublickeys/version.go @@ -0,0 +1,10 @@ +package sshpublickeys + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/sshpublickeys/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/README.md b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/README.md new file mode 100644 index 00000000000..af123178d3b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/README.md @@ -0,0 +1,68 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineextensionimages` Documentation + +The `virtualmachineextensionimages` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachineextensionimages" +``` + + +### Client Initialization + +```go +client := virtualmachineextensionimages.NewVirtualMachineExtensionImagesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineExtensionImagesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachineextensionimages.NewVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName", "versionName") + +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: `VirtualMachineExtensionImagesClient.ListTypes` + +```go +ctx := context.TODO() +id := virtualmachineextensionimages.NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + +read, err := client.ListTypes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineExtensionImagesClient.ListVersions` + +```go +ctx := context.TODO() +id := virtualmachineextensionimages.NewTypeID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName") + +read, err := client.ListVersions(ctx, id, virtualmachineextensionimages.DefaultListVersionsOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/client.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/client.go new file mode 100644 index 00000000000..4385ff41033 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/client.go @@ -0,0 +1,26 @@ +package virtualmachineextensionimages + +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 VirtualMachineExtensionImagesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineExtensionImagesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineExtensionImagesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachineextensionimages", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineExtensionImagesClient: %+v", err) + } + + return &VirtualMachineExtensionImagesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher.go new file mode 100644 index 00000000000..75185dcd3b3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher.go @@ -0,0 +1,130 @@ +package virtualmachineextensionimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&PublisherId{}) +} + +var _ resourceids.ResourceId = &PublisherId{} + +// PublisherId is a struct representing the Resource ID for a Publisher +type PublisherId struct { + SubscriptionId string + LocationName string + PublisherName string +} + +// NewPublisherID returns a new PublisherId struct +func NewPublisherID(subscriptionId string, locationName string, publisherName string) PublisherId { + return PublisherId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + } +} + +// ParsePublisherID parses 'input' into a PublisherId +func ParsePublisherID(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&PublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePublisherIDInsensitively parses 'input' case-insensitively into a PublisherId +// note: this method should only be used for API response data and not user input +func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&PublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + return nil +} + +// ValidatePublisherID checks that 'input' can be parsed as a Publisher ID +func ValidatePublisherID(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 := ParsePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Publisher ID +func (id PublisherId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Publisher ID +func (id PublisherId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + } +} + +// String returns a human-readable description of this Publisher ID +func (id PublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher_test.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher_test.go new file mode 100644 index 00000000000..a1107c02a89 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_publisher_test.go @@ -0,0 +1,282 @@ +package virtualmachineextensionimages + +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 = &PublisherId{} + +func TestNewPublisherID(t *testing.T) { + id := NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } +} + +func TestFormatPublisherID(t *testing.T) { + actual := NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePublisherID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PublisherId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePublisherID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestParsePublisherIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PublisherId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePublisherIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestSegmentsForPublisherId(t *testing.T) { + segments := PublisherId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PublisherId 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/compute/2024-11-01/virtualmachineextensionimages/id_type.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type.go new file mode 100644 index 00000000000..913ad5b4f1d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type.go @@ -0,0 +1,141 @@ +package virtualmachineextensionimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&TypeId{}) +} + +var _ resourceids.ResourceId = &TypeId{} + +// TypeId is a struct representing the Resource ID for a Type +type TypeId struct { + SubscriptionId string + LocationName string + PublisherName string + TypeName string +} + +// NewTypeID returns a new TypeId struct +func NewTypeID(subscriptionId string, locationName string, publisherName string, typeName string) TypeId { + return TypeId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + TypeName: typeName, + } +} + +// ParseTypeID parses 'input' into a TypeId +func ParseTypeID(input string) (*TypeId, error) { + parser := resourceids.NewParserFromResourceIdType(&TypeId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TypeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseTypeIDInsensitively parses 'input' case-insensitively into a TypeId +// note: this method should only be used for API response data and not user input +func ParseTypeIDInsensitively(input string) (*TypeId, error) { + parser := resourceids.NewParserFromResourceIdType(&TypeId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := TypeId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *TypeId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) + } + + return nil +} + +// ValidateTypeID checks that 'input' can be parsed as a Type ID +func ValidateTypeID(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 := ParseTypeID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Type ID +func (id TypeId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmExtension/types/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.TypeName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Type ID +func (id TypeId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmExtension", "vmExtension", "vmExtension"), + resourceids.StaticSegment("staticTypes", "types", "types"), + resourceids.UserSpecifiedSegment("typeName", "typeName"), + } +} + +// String returns a human-readable description of this Type ID +func (id TypeId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Type Name: %q", id.TypeName), + } + return fmt.Sprintf("Type (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type_test.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type_test.go new file mode 100644 index 00000000000..fdd8342e8e0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_type_test.go @@ -0,0 +1,357 @@ +package virtualmachineextensionimages + +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 = &TypeId{} + +func TestNewTypeID(t *testing.T) { + id := NewTypeID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.TypeName != "typeName" { + t.Fatalf("Expected %q but got %q for Segment 'TypeName'", id.TypeName, "typeName") + } +} + +func TestFormatTypeID(t *testing.T) { + actual := NewTypeID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseTypeID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *TypeId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Expected: &TypeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseTypeID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + } +} + +func TestParseTypeIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *TypeId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Expected: &TypeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE", + Expected: &TypeId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + TypeName: "tYpEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseTypeIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + } +} + +func TestSegmentsForTypeId(t *testing.T) { + segments := TypeId{}.Segments() + if len(segments) == 0 { + t.Fatalf("TypeId 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/compute/2024-11-01/virtualmachineextensionimages/id_version.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version.go new file mode 100644 index 00000000000..428dd802d6f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version.go @@ -0,0 +1,150 @@ +package virtualmachineextensionimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VersionId{}) +} + +var _ resourceids.ResourceId = &VersionId{} + +// VersionId is a struct representing the Resource ID for a Version +type VersionId struct { + SubscriptionId string + LocationName string + PublisherName string + TypeName string + VersionName string +} + +// NewVersionID returns a new VersionId struct +func NewVersionID(subscriptionId string, locationName string, publisherName string, typeName string, versionName string) VersionId { + return VersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + TypeName: typeName, + VersionName: versionName, + } +} + +// ParseVersionID parses 'input' into a VersionId +func ParseVersionID(input string) (*VersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVersionIDInsensitively parses 'input' case-insensitively into a VersionId +// note: this method should only be used for API response data and not user input +func ParseVersionIDInsensitively(input string) (*VersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VersionId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.TypeName, ok = input.Parsed["typeName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "typeName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateVersionID checks that 'input' can be parsed as a Version ID +func ValidateVersionID(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 := ParseVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Version ID +func (id VersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmExtension/types/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.TypeName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Version ID +func (id VersionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmExtension", "vmExtension", "vmExtension"), + resourceids.StaticSegment("staticTypes", "types", "types"), + resourceids.UserSpecifiedSegment("typeName", "typeName"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionName"), + } +} + +// String returns a human-readable description of this Version ID +func (id VersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Type Name: %q", id.TypeName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version_test.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version_test.go new file mode 100644 index 00000000000..9190aa87b20 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/id_version_test.go @@ -0,0 +1,402 @@ +package virtualmachineextensionimages + +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 = &VersionId{} + +func TestNewVersionID(t *testing.T) { + id := NewVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName", "versionName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.TypeName != "typeName" { + t.Fatalf("Expected %q but got %q for Segment 'TypeName'", id.TypeName, "typeName") + } + + if id.VersionName != "versionName" { + t.Fatalf("Expected %q but got %q for Segment 'VersionName'", id.VersionName, "versionName") + } +} + +func TestFormatVersionID(t *testing.T) { + actual := NewVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "typeName", "versionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VersionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName", + Expected: &VersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestParseVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VersionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/vErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName", + Expected: &VersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + TypeName: "typeName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmExtension/types/typeName/versions/versionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/vErSiOnS/vErSiOnNaMe", + Expected: &VersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + TypeName: "tYpEnAmE", + VersionName: "vErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMeXtEnSiOn/tYpEs/tYpEnAmE/vErSiOnS/vErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.TypeName != v.Expected.TypeName { + t.Fatalf("Expected %q but got %q for TypeName", v.Expected.TypeName, actual.TypeName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestSegmentsForVersionId(t *testing.T) { + segments := VersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VersionId 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/compute/2024-11-01/virtualmachineextensionimages/method_get.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_get.go new file mode 100644 index 00000000000..728c7b2ba56 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_get.go @@ -0,0 +1,53 @@ +package virtualmachineextensionimages + +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 *VirtualMachineExtensionImage +} + +// Get ... +func (c VirtualMachineExtensionImagesClient) Get(ctx context.Context, id VersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineExtensionImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listtypes.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listtypes.go new file mode 100644 index 00000000000..b9f09407bc0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listtypes.go @@ -0,0 +1,54 @@ +package virtualmachineextensionimages + +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 ListTypesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineExtensionImage +} + +// ListTypes ... +func (c VirtualMachineExtensionImagesClient) ListTypes(ctx context.Context, id PublisherId) (result ListTypesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/artifactTypes/vmExtension/types", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineExtensionImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listversions.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listversions.go new file mode 100644 index 00000000000..2cedae68952 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/method_listversions.go @@ -0,0 +1,91 @@ +package virtualmachineextensionimages + +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 ListVersionsOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineExtensionImage +} + +type ListVersionsOperationOptions struct { + Filter *string + Orderby *string + Top *int64 +} + +func DefaultListVersionsOperationOptions() ListVersionsOperationOptions { + return ListVersionsOperationOptions{} +} + +func (o ListVersionsOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListVersionsOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListVersionsOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// ListVersions ... +func (c VirtualMachineExtensionImagesClient) ListVersions(ctx context.Context, id TypeId, options ListVersionsOperationOptions) (result ListVersionsOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/versions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineExtensionImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimage.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimage.go new file mode 100644 index 00000000000..876d3af51d4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimage.go @@ -0,0 +1,13 @@ +package virtualmachineextensionimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionImage struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionImageProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimageproperties.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimageproperties.go new file mode 100644 index 00000000000..8c68451dfb6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/model_virtualmachineextensionimageproperties.go @@ -0,0 +1,12 @@ +package virtualmachineextensionimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionImageProperties struct { + ComputeRole string `json:"computeRole"` + HandlerSchema string `json:"handlerSchema"` + OperatingSystem string `json:"operatingSystem"` + SupportsMultipleExtensions *bool `json:"supportsMultipleExtensions,omitempty"` + VMScaleSetEnabled *bool `json:"vmScaleSetEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensionimages/version.go b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/version.go new file mode 100644 index 00000000000..8b52664d666 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensionimages/version.go @@ -0,0 +1,10 @@ +package virtualmachineextensionimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachineextensionimages/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/README.md b/resource-manager/compute/2024-11-01/virtualmachineextensions/README.md new file mode 100644 index 00000000000..7534be43889 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineextensions` Documentation + +The `virtualmachineextensions` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachineextensions" +``` + + +### Client Initialization + +```go +client := virtualmachineextensions.NewVirtualMachineExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +payload := virtualmachineextensions.VirtualMachineExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +read, err := client.Get(ctx, id, virtualmachineextensions.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.List` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.List(ctx, id, virtualmachineextensions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineExtensionsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachineextensions.NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + +payload := virtualmachineextensions.VirtualMachineExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/client.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/client.go new file mode 100644 index 00000000000..c049fb742ed --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/client.go @@ -0,0 +1,26 @@ +package virtualmachineextensions + +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 VirtualMachineExtensionsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineExtensionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachineextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineExtensionsClient: %+v", err) + } + + return &VirtualMachineExtensionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/constants.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/constants.go new file mode 100644 index 00000000000..d07852c0696 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/constants.go @@ -0,0 +1,54 @@ +package virtualmachineextensions + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension.go new file mode 100644 index 00000000000..72168cd7ce0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension.go @@ -0,0 +1,139 @@ +package virtualmachineextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&ExtensionId{}) +} + +var _ resourceids.ResourceId = &ExtensionId{} + +// ExtensionId is a struct representing the Resource ID for a Extension +type ExtensionId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string + ExtensionName string +} + +// NewExtensionID returns a new ExtensionId struct +func NewExtensionID(subscriptionId string, resourceGroupName string, virtualMachineName string, extensionName string) ExtensionId { + return ExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + ExtensionName: extensionName, + } +} + +// ParseExtensionID parses 'input' into a ExtensionId +func ParseExtensionID(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseExtensionIDInsensitively parses 'input' case-insensitively into a ExtensionId +// note: this method should only be used for API response data and not user input +func ParseExtensionIDInsensitively(input string) (*ExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&ExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := ExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *ExtensionId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) + } + + return nil +} + +// ValidateExtensionID checks that 'input' can be parsed as a Extension ID +func ValidateExtensionID(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 := ParseExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Extension ID +func (id ExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Extension ID +func (id ExtensionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionName"), + } +} + +// String returns a human-readable description of this Extension ID +func (id ExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Extension (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension_test.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension_test.go new file mode 100644 index 00000000000..29ca0c38d57 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_extension_test.go @@ -0,0 +1,327 @@ +package virtualmachineextensions + +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 = &ExtensionId{} + +func TestNewExtensionID(t *testing.T) { + id := NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName") + + 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.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } + + if id.ExtensionName != "extensionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExtensionName'", id.ExtensionName, "extensionName") + } +} + +func TestFormatExtensionID(t *testing.T) { + actual := NewExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "extensionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseExtensionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExtensionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName", + Expected: &ExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExtensionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestParseExtensionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *ExtensionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/eXtEnSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName", + Expected: &ExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extensions/extensionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/eXtEnSiOnS/eXtEnSiOnNaMe", + Expected: &ExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + ExtensionName: "eXtEnSiOnNaMe", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/eXtEnSiOnS/eXtEnSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseExtensionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestSegmentsForExtensionId(t *testing.T) { + segments := ExtensionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("ExtensionId 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/compute/2024-11-01/virtualmachineextensions/id_virtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine.go new file mode 100644 index 00000000000..01381ed6d4b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine.go @@ -0,0 +1,130 @@ +package virtualmachineextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + return nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(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 := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine_test.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine_test.go new file mode 100644 index 00000000000..2987f6776a3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/id_virtualmachine_test.go @@ -0,0 +1,282 @@ +package virtualmachineextensions + +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 = &VirtualMachineId{} + +func TestNewVirtualMachineID(t *testing.T) { + id := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + + 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.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } +} + +func TestFormatVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestParseVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestSegmentsForVirtualMachineId(t *testing.T) { + segments := VirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineId 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/compute/2024-11-01/virtualmachineextensions/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_createorupdate.go new file mode 100644 index 00000000000..c4663f81156 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineExtension +} + +// CreateOrUpdate ... +func (c VirtualMachineExtensionsClient) CreateOrUpdate(ctx context.Context, id ExtensionId, input VirtualMachineExtension) (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 VirtualMachineExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id ExtensionId, input VirtualMachineExtension) 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/compute/2024-11-01/virtualmachineextensions/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_delete.go new file mode 100644 index 00000000000..6af6e709fe4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachineextensions + +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 VirtualMachineExtensionsClient) Delete(ctx context.Context, id ExtensionId) (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 VirtualMachineExtensionsClient) DeleteThenPoll(ctx context.Context, id ExtensionId) 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/compute/2024-11-01/virtualmachineextensions/method_get.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_get.go new file mode 100644 index 00000000000..081bdecb6ff --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_get.go @@ -0,0 +1,83 @@ +package virtualmachineextensions + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineExtension +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineExtensionsClient) Get(ctx context.Context, id ExtensionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineExtension + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/method_list.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_list.go new file mode 100644 index 00000000000..b495c3fa1d5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_list.go @@ -0,0 +1,83 @@ +package virtualmachineextensions + +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 *VirtualMachineExtensionsListResult +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// List ... +func (c VirtualMachineExtensionsClient) List(ctx context.Context, id VirtualMachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/extensions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineExtensionsListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/method_update.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_update.go new file mode 100644 index 00000000000..b83bdd84908 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/method_update.go @@ -0,0 +1,74 @@ +package virtualmachineextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineExtension +} + +// Update ... +func (c VirtualMachineExtensionsClient) Update(ctx context.Context, id ExtensionId, input VirtualMachineExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 VirtualMachineExtensionsClient) UpdateThenPoll(ctx context.Context, id ExtensionId, input VirtualMachineExtensionUpdate) 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/compute/2024-11-01/virtualmachineextensions/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_instanceviewstatus.go new file mode 100644 index 00000000000..88fe6a10b4d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachineextensions + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..ba308b046a4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_subresource.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_subresource.go new file mode 100644 index 00000000000..1bd7575c8ac --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextension.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextension.go new file mode 100644 index 00000000000..c0fb12d5ca9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextension.go @@ -0,0 +1,13 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..f9209af2f35 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionproperties.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..04be01e454a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go new file mode 100644 index 00000000000..006db2198b4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionslistresult.go @@ -0,0 +1,8 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionsListResult struct { + Value *[]VirtualMachineExtension `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdate.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdate.go new file mode 100644 index 00000000000..55b5acdf30e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdate.go @@ -0,0 +1,9 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionUpdate struct { + Properties *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go new file mode 100644 index 00000000000..e000a1a1b65 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/model_virtualmachineextensionupdateproperties.go @@ -0,0 +1,17 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionUpdateProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineextensions/version.go b/resource-manager/compute/2024-11-01/virtualmachineextensions/version.go new file mode 100644 index 00000000000..2722fec6ad3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineextensions/version.go @@ -0,0 +1,10 @@ +package virtualmachineextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachineextensions/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/README.md b/resource-manager/compute/2024-11-01/virtualmachineimages/README.md new file mode 100644 index 00000000000..4f95c309a89 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/README.md @@ -0,0 +1,197 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineimages` Documentation + +The `virtualmachineimages` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachineimages" +``` + + +### Client Initialization + +```go +client := virtualmachineimages.NewVirtualMachineImagesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineImagesClient.EdgeZoneGet` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewOfferSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName", "versionName") + +read, err := client.EdgeZoneGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.EdgeZoneList` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewOfferSkuID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName") + +read, err := client.EdgeZoneList(ctx, id, virtualmachineimages.DefaultEdgeZoneListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.EdgeZoneListOffers` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewEdgeZonePublisherID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName") + +read, err := client.EdgeZoneListOffers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.EdgeZoneListPublishers` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName") + +read, err := client.EdgeZoneListPublishers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.EdgeZoneListSkus` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewVMImageOfferID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName") + +read, err := client.EdgeZoneListSkus(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName", "versionName") + +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: `VirtualMachineImagesClient.List` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewSkuID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName") + +read, err := client.List(ctx, id, virtualmachineimages.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.ListByEdgeZone` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName") + +// alternatively `client.ListByEdgeZone(ctx, id)` can be used to do batched pagination +items, err := client.ListByEdgeZoneComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineImagesClient.ListOffers` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + +read, err := client.ListOffers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.ListPublishers` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +read, err := client.ListPublishers(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineImagesClient.ListSkus` + +```go +ctx := context.TODO() +id := virtualmachineimages.NewOfferID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName") + +read, err := client.ListSkus(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/compute/2024-11-01/virtualmachineimages/client.go b/resource-manager/compute/2024-11-01/virtualmachineimages/client.go new file mode 100644 index 00000000000..05c5fd93d49 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/client.go @@ -0,0 +1,26 @@ +package virtualmachineimages + +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 VirtualMachineImagesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineImagesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineImagesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachineimages", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineImagesClient: %+v", err) + } + + return &VirtualMachineImagesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/constants.go b/resource-manager/compute/2024-11-01/virtualmachineimages/constants.go new file mode 100644 index 00000000000..e1c9169668f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/constants.go @@ -0,0 +1,262 @@ +package virtualmachineimages + +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 AlternativeType string + +const ( + AlternativeTypeNone AlternativeType = "None" + AlternativeTypeOffer AlternativeType = "Offer" + AlternativeTypePlan AlternativeType = "Plan" +) + +func PossibleValuesForAlternativeType() []string { + return []string{ + string(AlternativeTypeNone), + string(AlternativeTypeOffer), + string(AlternativeTypePlan), + } +} + +func (s *AlternativeType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAlternativeType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAlternativeType(input string) (*AlternativeType, error) { + vals := map[string]AlternativeType{ + "none": AlternativeTypeNone, + "offer": AlternativeTypeOffer, + "plan": AlternativeTypePlan, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AlternativeType(input) + return &out, nil +} + +type ArchitectureTypes string + +const ( + ArchitectureTypesArmSixFour ArchitectureTypes = "Arm64" + ArchitectureTypesXSixFour ArchitectureTypes = "x64" +) + +func PossibleValuesForArchitectureTypes() []string { + return []string{ + string(ArchitectureTypesArmSixFour), + string(ArchitectureTypesXSixFour), + } +} + +func (s *ArchitectureTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseArchitectureTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseArchitectureTypes(input string) (*ArchitectureTypes, error) { + vals := map[string]ArchitectureTypes{ + "arm64": ArchitectureTypesArmSixFour, + "x64": ArchitectureTypesXSixFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ArchitectureTypes(input) + return &out, nil +} + +type HyperVGenerationTypes string + +const ( + HyperVGenerationTypesVOne HyperVGenerationTypes = "V1" + HyperVGenerationTypesVTwo HyperVGenerationTypes = "V2" +) + +func PossibleValuesForHyperVGenerationTypes() []string { + return []string{ + string(HyperVGenerationTypesVOne), + string(HyperVGenerationTypesVTwo), + } +} + +func (s *HyperVGenerationTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationTypes(input string) (*HyperVGenerationTypes, error) { + vals := map[string]HyperVGenerationTypes{ + "v1": HyperVGenerationTypesVOne, + "v2": HyperVGenerationTypesVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationTypes(input) + return &out, nil +} + +type ImageState string + +const ( + ImageStateActive ImageState = "Active" + ImageStateDeprecated ImageState = "Deprecated" + ImageStateScheduledForDeprecation ImageState = "ScheduledForDeprecation" +) + +func PossibleValuesForImageState() []string { + return []string{ + string(ImageStateActive), + string(ImageStateDeprecated), + string(ImageStateScheduledForDeprecation), + } +} + +func (s *ImageState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseImageState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseImageState(input string) (*ImageState, error) { + vals := map[string]ImageState{ + "active": ImageStateActive, + "deprecated": ImageStateDeprecated, + "scheduledfordeprecation": ImageStateScheduledForDeprecation, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ImageState(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type VMDiskTypes string + +const ( + VMDiskTypesNone VMDiskTypes = "None" + VMDiskTypesUnmanaged VMDiskTypes = "Unmanaged" +) + +func PossibleValuesForVMDiskTypes() []string { + return []string{ + string(VMDiskTypesNone), + string(VMDiskTypesUnmanaged), + } +} + +func (s *VMDiskTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMDiskTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMDiskTypes(input string) (*VMDiskTypes, error) { + vals := map[string]VMDiskTypes{ + "none": VMDiskTypesNone, + "unmanaged": VMDiskTypesUnmanaged, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMDiskTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone.go new file mode 100644 index 00000000000..4589fd49c69 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone.go @@ -0,0 +1,130 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&EdgeZoneId{}) +} + +var _ resourceids.ResourceId = &EdgeZoneId{} + +// EdgeZoneId is a struct representing the Resource ID for a Edge Zone +type EdgeZoneId struct { + SubscriptionId string + LocationName string + EdgeZoneName string +} + +// NewEdgeZoneID returns a new EdgeZoneId struct +func NewEdgeZoneID(subscriptionId string, locationName string, edgeZoneName string) EdgeZoneId { + return EdgeZoneId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + } +} + +// ParseEdgeZoneID parses 'input' into a EdgeZoneId +func ParseEdgeZoneID(input string) (*EdgeZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZoneId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseEdgeZoneIDInsensitively parses 'input' case-insensitively into a EdgeZoneId +// note: this method should only be used for API response data and not user input +func ParseEdgeZoneIDInsensitively(input string) (*EdgeZoneId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZoneId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZoneId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZoneId) 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.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + return nil +} + +// ValidateEdgeZoneID checks that 'input' can be parsed as a Edge Zone ID +func ValidateEdgeZoneID(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 := ParseEdgeZoneID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Edge Zone ID +func (id EdgeZoneId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Edge Zone ID +func (id EdgeZoneId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + } +} + +// String returns a human-readable description of this Edge Zone ID +func (id EdgeZoneId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + } + return fmt.Sprintf("Edge Zone (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone_test.go new file mode 100644 index 00000000000..179025c0a66 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezone_test.go @@ -0,0 +1,282 @@ +package virtualmachineimages + +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 = &EdgeZoneId{} + +func TestNewEdgeZoneID(t *testing.T) { + id := NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } +} + +func TestFormatEdgeZoneID(t *testing.T) { + actual := NewEdgeZoneID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseEdgeZoneID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZoneId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Expected: &EdgeZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZoneID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + } +} + +func TestParseEdgeZoneIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZoneId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Expected: &EdgeZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Expected: &EdgeZoneId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZoneIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + } +} + +func TestSegmentsForEdgeZoneId(t *testing.T) { + segments := EdgeZoneId{}.Segments() + if len(segments) == 0 { + t.Fatalf("EdgeZoneId 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/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher.go new file mode 100644 index 00000000000..413b714876a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher.go @@ -0,0 +1,139 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&EdgeZonePublisherId{}) +} + +var _ resourceids.ResourceId = &EdgeZonePublisherId{} + +// EdgeZonePublisherId is a struct representing the Resource ID for a Edge Zone Publisher +type EdgeZonePublisherId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string +} + +// NewEdgeZonePublisherID returns a new EdgeZonePublisherId struct +func NewEdgeZonePublisherID(subscriptionId string, locationName string, edgeZoneName string, publisherName string) EdgeZonePublisherId { + return EdgeZonePublisherId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + } +} + +// ParseEdgeZonePublisherID parses 'input' into a EdgeZonePublisherId +func ParseEdgeZonePublisherID(input string) (*EdgeZonePublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZonePublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZonePublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseEdgeZonePublisherIDInsensitively parses 'input' case-insensitively into a EdgeZonePublisherId +// note: this method should only be used for API response data and not user input +func ParseEdgeZonePublisherIDInsensitively(input string) (*EdgeZonePublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&EdgeZonePublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := EdgeZonePublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *EdgeZonePublisherId) 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.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + return nil +} + +// ValidateEdgeZonePublisherID checks that 'input' can be parsed as a Edge Zone Publisher ID +func ValidateEdgeZonePublisherID(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 := ParseEdgeZonePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Edge Zone Publisher ID +func (id EdgeZonePublisherId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Edge Zone Publisher ID +func (id EdgeZonePublisherId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + } +} + +// String returns a human-readable description of this Edge Zone Publisher ID +func (id EdgeZonePublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Edge Zone Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher_test.go new file mode 100644 index 00000000000..481cc03e568 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_edgezonepublisher_test.go @@ -0,0 +1,327 @@ +package virtualmachineimages + +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 = &EdgeZonePublisherId{} + +func TestNewEdgeZonePublisherID(t *testing.T) { + id := NewEdgeZonePublisherID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } +} + +func TestFormatEdgeZonePublisherID(t *testing.T) { + actual := NewEdgeZonePublisherID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseEdgeZonePublisherID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZonePublisherId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Expected: &EdgeZonePublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZonePublisherID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestParseEdgeZonePublisherIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *EdgeZonePublisherId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Expected: &EdgeZonePublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Expected: &EdgeZonePublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseEdgeZonePublisherIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestSegmentsForEdgeZonePublisherId(t *testing.T) { + segments := EdgeZonePublisherId{}.Segments() + if len(segments) == 0 { + t.Fatalf("EdgeZonePublisherId 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/compute/2024-11-01/virtualmachineimages/id_location.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_location.go new file mode 100644 index 00000000000..bc87fc5d8b3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_location.go @@ -0,0 +1,121 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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.Compute/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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/compute/2024-11-01/virtualmachineimages/id_location_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_location_test.go new file mode 100644 index 00000000000..ba21e1bba3c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_location_test.go @@ -0,0 +1,237 @@ +package virtualmachineimages + +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", "locationName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/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/compute/2024-11-01/virtualmachineimages/id_offer.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offer.go new file mode 100644 index 00000000000..555733f938b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offer.go @@ -0,0 +1,141 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&OfferId{}) +} + +var _ resourceids.ResourceId = &OfferId{} + +// OfferId is a struct representing the Resource ID for a Offer +type OfferId struct { + SubscriptionId string + LocationName string + PublisherName string + OfferName string +} + +// NewOfferID returns a new OfferId struct +func NewOfferID(subscriptionId string, locationName string, publisherName string, offerName string) OfferId { + return OfferId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + OfferName: offerName, + } +} + +// ParseOfferID parses 'input' into a OfferId +func ParseOfferID(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOfferIDInsensitively parses 'input' case-insensitively into a OfferId +// note: this method should only be used for API response data and not user input +func ParseOfferIDInsensitively(input string) (*OfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + return nil +} + +// ValidateOfferID checks that 'input' can be parsed as a Offer ID +func ValidateOfferID(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 := ParseOfferID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer ID +func (id OfferId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmImage/offers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.OfferName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer ID +func (id OfferId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + } +} + +// String returns a human-readable description of this Offer ID +func (id OfferId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + } + return fmt.Sprintf("Offer (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_offer_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offer_test.go new file mode 100644 index 00000000000..20ee9d771ba --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offer_test.go @@ -0,0 +1,357 @@ +package virtualmachineimages + +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 = &OfferId{} + +func TestNewOfferID(t *testing.T) { + id := NewOfferID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } +} + +func TestFormatOfferID(t *testing.T) { + actual := NewOfferID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOfferID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &OfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestParseOfferIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &OfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Expected: &OfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestSegmentsForOfferId(t *testing.T) { + segments := OfferId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OfferId 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/compute/2024-11-01/virtualmachineimages/id_offersku.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku.go new file mode 100644 index 00000000000..616277032de --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku.go @@ -0,0 +1,159 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&OfferSkuId{}) +} + +var _ resourceids.ResourceId = &OfferSkuId{} + +// OfferSkuId is a struct representing the Resource ID for a Offer Sku +type OfferSkuId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string + OfferName string + SkuName string +} + +// NewOfferSkuID returns a new OfferSkuId struct +func NewOfferSkuID(subscriptionId string, locationName string, edgeZoneName string, publisherName string, offerName string, skuName string) OfferSkuId { + return OfferSkuId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + } +} + +// ParseOfferSkuID parses 'input' into a OfferSkuId +func ParseOfferSkuID(input string) (*OfferSkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOfferSkuIDInsensitively parses 'input' case-insensitively into a OfferSkuId +// note: this method should only be used for API response data and not user input +func ParseOfferSkuIDInsensitively(input string) (*OfferSkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferSkuId) 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.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + return nil +} + +// ValidateOfferSkuID checks that 'input' can be parsed as a Offer Sku ID +func ValidateOfferSkuID(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 := ParseOfferSkuID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer Sku ID +func (id OfferSkuId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName, id.OfferName, id.SkuName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer Sku ID +func (id OfferSkuId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + } +} + +// String returns a human-readable description of this Offer Sku ID +func (id OfferSkuId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + } + return fmt.Sprintf("Offer Sku (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku_test.go new file mode 100644 index 00000000000..b580e4c3fca --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offersku_test.go @@ -0,0 +1,447 @@ +package virtualmachineimages + +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 = &OfferSkuId{} + +func TestNewOfferSkuID(t *testing.T) { + id := NewOfferSkuID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } +} + +func TestFormatOfferSkuID(t *testing.T) { + actual := NewOfferSkuID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOfferSkuID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &OfferSkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestParseOfferSkuIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &OfferSkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Expected: &OfferSkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestSegmentsForOfferSkuId(t *testing.T) { + segments := OfferSkuId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OfferSkuId 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/compute/2024-11-01/virtualmachineimages/id_offerskuversion.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion.go new file mode 100644 index 00000000000..c6d89f817f3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion.go @@ -0,0 +1,168 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&OfferSkuVersionId{}) +} + +var _ resourceids.ResourceId = &OfferSkuVersionId{} + +// OfferSkuVersionId is a struct representing the Resource ID for a Offer Sku Version +type OfferSkuVersionId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string + OfferName string + SkuName string + VersionName string +} + +// NewOfferSkuVersionID returns a new OfferSkuVersionId struct +func NewOfferSkuVersionID(subscriptionId string, locationName string, edgeZoneName string, publisherName string, offerName string, skuName string, versionName string) OfferSkuVersionId { + return OfferSkuVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + VersionName: versionName, + } +} + +// ParseOfferSkuVersionID parses 'input' into a OfferSkuVersionId +func ParseOfferSkuVersionID(input string) (*OfferSkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseOfferSkuVersionIDInsensitively parses 'input' case-insensitively into a OfferSkuVersionId +// note: this method should only be used for API response data and not user input +func ParseOfferSkuVersionIDInsensitively(input string) (*OfferSkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&OfferSkuVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := OfferSkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *OfferSkuVersionId) 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.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateOfferSkuVersionID checks that 'input' can be parsed as a Offer Sku Version ID +func ValidateOfferSkuVersionID(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 := ParseOfferSkuVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Offer Sku Version ID +func (id OfferSkuVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName, id.OfferName, id.SkuName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Offer Sku Version ID +func (id OfferSkuVersionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionName"), + } +} + +// String returns a human-readable description of this Offer Sku Version ID +func (id OfferSkuVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Offer Sku Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion_test.go new file mode 100644 index 00000000000..e8bc8c4c903 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_offerskuversion_test.go @@ -0,0 +1,492 @@ +package virtualmachineimages + +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 = &OfferSkuVersionId{} + +func TestNewOfferSkuVersionID(t *testing.T) { + id := NewOfferSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName", "versionName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } + + if id.VersionName != "versionName" { + t.Fatalf("Expected %q but got %q for Segment 'VersionName'", id.VersionName, "versionName") + } +} + +func TestFormatOfferSkuVersionID(t *testing.T) { + actual := NewOfferSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName", "skuName", "versionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseOfferSkuVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuVersionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &OfferSkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestParseOfferSkuVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *OfferSkuVersionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &OfferSkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe", + Expected: &OfferSkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + VersionName: "vErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseOfferSkuVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestSegmentsForOfferSkuVersionId(t *testing.T) { + segments := OfferSkuVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("OfferSkuVersionId 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/compute/2024-11-01/virtualmachineimages/id_publisher.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher.go new file mode 100644 index 00000000000..732498f2f76 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher.go @@ -0,0 +1,130 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&PublisherId{}) +} + +var _ resourceids.ResourceId = &PublisherId{} + +// PublisherId is a struct representing the Resource ID for a Publisher +type PublisherId struct { + SubscriptionId string + LocationName string + PublisherName string +} + +// NewPublisherID returns a new PublisherId struct +func NewPublisherID(subscriptionId string, locationName string, publisherName string) PublisherId { + return PublisherId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + } +} + +// ParsePublisherID parses 'input' into a PublisherId +func ParsePublisherID(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&PublisherId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePublisherIDInsensitively parses 'input' case-insensitively into a PublisherId +// note: this method should only be used for API response data and not user input +func ParsePublisherIDInsensitively(input string) (*PublisherId, error) { + parser := resourceids.NewParserFromResourceIdType(&PublisherId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PublisherId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PublisherId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + return nil +} + +// ValidatePublisherID checks that 'input' can be parsed as a Publisher ID +func ValidatePublisherID(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 := ParsePublisherID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Publisher ID +func (id PublisherId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Publisher ID +func (id PublisherId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + } +} + +// String returns a human-readable description of this Publisher ID +func (id PublisherId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + } + return fmt.Sprintf("Publisher (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher_test.go new file mode 100644 index 00000000000..320e179981f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_publisher_test.go @@ -0,0 +1,282 @@ +package virtualmachineimages + +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 = &PublisherId{} + +func TestNewPublisherID(t *testing.T) { + id := NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } +} + +func TestFormatPublisherID(t *testing.T) { + actual := NewPublisherID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePublisherID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PublisherId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePublisherID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestParsePublisherIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PublisherId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Expected: &PublisherId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePublisherIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + } +} + +func TestSegmentsForPublisherId(t *testing.T) { + segments := PublisherId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PublisherId 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/compute/2024-11-01/virtualmachineimages/id_sku.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_sku.go new file mode 100644 index 00000000000..86196817181 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_sku.go @@ -0,0 +1,150 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&SkuId{}) +} + +var _ resourceids.ResourceId = &SkuId{} + +// SkuId is a struct representing the Resource ID for a Sku +type SkuId struct { + SubscriptionId string + LocationName string + PublisherName string + OfferName string + SkuName string +} + +// NewSkuID returns a new SkuId struct +func NewSkuID(subscriptionId string, locationName string, publisherName string, offerName string, skuName string) SkuId { + return SkuId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + } +} + +// ParseSkuID parses 'input' into a SkuId +func ParseSkuID(input string) (*SkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSkuIDInsensitively parses 'input' case-insensitively into a SkuId +// note: this method should only be used for API response data and not user input +func ParseSkuIDInsensitively(input string) (*SkuId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SkuId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + return nil +} + +// ValidateSkuID checks that 'input' can be parsed as a Sku ID +func ValidateSkuID(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 := ParseSkuID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sku ID +func (id SkuId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.OfferName, id.SkuName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sku ID +func (id SkuId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + } +} + +// String returns a human-readable description of this Sku ID +func (id SkuId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + } + return fmt.Sprintf("Sku (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_sku_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_sku_test.go new file mode 100644 index 00000000000..7148e671250 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_sku_test.go @@ -0,0 +1,402 @@ +package virtualmachineimages + +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 = &SkuId{} + +func TestNewSkuID(t *testing.T) { + id := NewSkuID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } +} + +func TestFormatSkuID(t *testing.T) { + actual := NewSkuID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSkuID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &SkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestParseSkuIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Expected: &SkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Expected: &SkuId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + } +} + +func TestSegmentsForSkuId(t *testing.T) { + segments := SkuId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SkuId 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/compute/2024-11-01/virtualmachineimages/id_skuversion.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion.go new file mode 100644 index 00000000000..e6327d8297c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion.go @@ -0,0 +1,159 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&SkuVersionId{}) +} + +var _ resourceids.ResourceId = &SkuVersionId{} + +// SkuVersionId is a struct representing the Resource ID for a Sku Version +type SkuVersionId struct { + SubscriptionId string + LocationName string + PublisherName string + OfferName string + SkuName string + VersionName string +} + +// NewSkuVersionID returns a new SkuVersionId struct +func NewSkuVersionID(subscriptionId string, locationName string, publisherName string, offerName string, skuName string, versionName string) SkuVersionId { + return SkuVersionId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + PublisherName: publisherName, + OfferName: offerName, + SkuName: skuName, + VersionName: versionName, + } +} + +// ParseSkuVersionID parses 'input' into a SkuVersionId +func ParseSkuVersionID(input string) (*SkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuVersionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseSkuVersionIDInsensitively parses 'input' case-insensitively into a SkuVersionId +// note: this method should only be used for API response data and not user input +func ParseSkuVersionIDInsensitively(input string) (*SkuVersionId, error) { + parser := resourceids.NewParserFromResourceIdType(&SkuVersionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := SkuVersionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *SkuVersionId) 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.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + if id.SkuName, ok = input.Parsed["skuName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "skuName", input) + } + + if id.VersionName, ok = input.Parsed["versionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "versionName", input) + } + + return nil +} + +// ValidateSkuVersionID checks that 'input' can be parsed as a Sku Version ID +func ValidateSkuVersionID(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 := ParseSkuVersionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Sku Version ID +func (id SkuVersionId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/artifactTypes/vmImage/offers/%s/skus/%s/versions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.PublisherName, id.OfferName, id.SkuName, id.VersionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Sku Version ID +func (id SkuVersionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + resourceids.StaticSegment("staticSkus", "skus", "skus"), + resourceids.UserSpecifiedSegment("skuName", "skuName"), + resourceids.StaticSegment("staticVersions", "versions", "versions"), + resourceids.UserSpecifiedSegment("versionName", "versionName"), + } +} + +// String returns a human-readable description of this Sku Version ID +func (id SkuVersionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + fmt.Sprintf("Sku Name: %q", id.SkuName), + fmt.Sprintf("Version Name: %q", id.VersionName), + } + return fmt.Sprintf("Sku Version (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion_test.go new file mode 100644 index 00000000000..71033afa5fe --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_skuversion_test.go @@ -0,0 +1,447 @@ +package virtualmachineimages + +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 = &SkuVersionId{} + +func TestNewSkuVersionID(t *testing.T) { + id := NewSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName", "versionName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } + + if id.SkuName != "skuName" { + t.Fatalf("Expected %q but got %q for Segment 'SkuName'", id.SkuName, "skuName") + } + + if id.VersionName != "versionName" { + t.Fatalf("Expected %q but got %q for Segment 'VersionName'", id.VersionName, "versionName") + } +} + +func TestFormatSkuVersionID(t *testing.T) { + actual := NewSkuVersionID("12345678-1234-9876-4563-123456789012", "locationName", "publisherName", "offerName", "skuName", "versionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseSkuVersionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuVersionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &SkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuVersionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestParseSkuVersionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *SkuVersionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName", + Expected: &SkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + PublisherName: "publisherName", + OfferName: "offerName", + SkuName: "skuName", + VersionName: "versionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/skus/skuName/versions/versionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe", + Expected: &SkuVersionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + SkuName: "sKuNaMe", + VersionName: "vErSiOnNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/sKuS/sKuNaMe/vErSiOnS/vErSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseSkuVersionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + if actual.SkuName != v.Expected.SkuName { + t.Fatalf("Expected %q but got %q for SkuName", v.Expected.SkuName, actual.SkuName) + } + + if actual.VersionName != v.Expected.VersionName { + t.Fatalf("Expected %q but got %q for VersionName", v.Expected.VersionName, actual.VersionName) + } + + } +} + +func TestSegmentsForSkuVersionId(t *testing.T) { + segments := SkuVersionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("SkuVersionId 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/compute/2024-11-01/virtualmachineimages/id_vmimageoffer.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer.go new file mode 100644 index 00000000000..2739d80c546 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer.go @@ -0,0 +1,150 @@ +package virtualmachineimages + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VMImageOfferId{}) +} + +var _ resourceids.ResourceId = &VMImageOfferId{} + +// VMImageOfferId is a struct representing the Resource ID for a V M Image Offer +type VMImageOfferId struct { + SubscriptionId string + LocationName string + EdgeZoneName string + PublisherName string + OfferName string +} + +// NewVMImageOfferID returns a new VMImageOfferId struct +func NewVMImageOfferID(subscriptionId string, locationName string, edgeZoneName string, publisherName string, offerName string) VMImageOfferId { + return VMImageOfferId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + EdgeZoneName: edgeZoneName, + PublisherName: publisherName, + OfferName: offerName, + } +} + +// ParseVMImageOfferID parses 'input' into a VMImageOfferId +func ParseVMImageOfferID(input string) (*VMImageOfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMImageOfferId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMImageOfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVMImageOfferIDInsensitively parses 'input' case-insensitively into a VMImageOfferId +// note: this method should only be used for API response data and not user input +func ParseVMImageOfferIDInsensitively(input string) (*VMImageOfferId, error) { + parser := resourceids.NewParserFromResourceIdType(&VMImageOfferId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VMImageOfferId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VMImageOfferId) 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.EdgeZoneName, ok = input.Parsed["edgeZoneName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "edgeZoneName", input) + } + + if id.PublisherName, ok = input.Parsed["publisherName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "publisherName", input) + } + + if id.OfferName, ok = input.Parsed["offerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "offerName", input) + } + + return nil +} + +// ValidateVMImageOfferID checks that 'input' can be parsed as a V M Image Offer ID +func ValidateVMImageOfferID(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 := ParseVMImageOfferID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted V M Image Offer ID +func (id VMImageOfferId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/edgeZones/%s/publishers/%s/artifactTypes/vmImage/offers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.EdgeZoneName, id.PublisherName, id.OfferName) +} + +// Segments returns a slice of Resource ID Segments which comprise this V M Image Offer ID +func (id VMImageOfferId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticEdgeZones", "edgeZones", "edgeZones"), + resourceids.UserSpecifiedSegment("edgeZoneName", "edgeZoneName"), + resourceids.StaticSegment("staticPublishers", "publishers", "publishers"), + resourceids.UserSpecifiedSegment("publisherName", "publisherName"), + resourceids.StaticSegment("staticArtifactTypes", "artifactTypes", "artifactTypes"), + resourceids.StaticSegment("staticVmImage", "vmImage", "vmImage"), + resourceids.StaticSegment("staticOffers", "offers", "offers"), + resourceids.UserSpecifiedSegment("offerName", "offerName"), + } +} + +// String returns a human-readable description of this V M Image Offer ID +func (id VMImageOfferId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Edge Zone Name: %q", id.EdgeZoneName), + fmt.Sprintf("Publisher Name: %q", id.PublisherName), + fmt.Sprintf("Offer Name: %q", id.OfferName), + } + return fmt.Sprintf("V M Image Offer (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer_test.go b/resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer_test.go new file mode 100644 index 00000000000..1ecef60694e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/id_vmimageoffer_test.go @@ -0,0 +1,402 @@ +package virtualmachineimages + +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 = &VMImageOfferId{} + +func TestNewVMImageOfferID(t *testing.T) { + id := NewVMImageOfferID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.EdgeZoneName != "edgeZoneName" { + t.Fatalf("Expected %q but got %q for Segment 'EdgeZoneName'", id.EdgeZoneName, "edgeZoneName") + } + + if id.PublisherName != "publisherName" { + t.Fatalf("Expected %q but got %q for Segment 'PublisherName'", id.PublisherName, "publisherName") + } + + if id.OfferName != "offerName" { + t.Fatalf("Expected %q but got %q for Segment 'OfferName'", id.OfferName, "offerName") + } +} + +func TestFormatVMImageOfferID(t *testing.T) { + actual := NewVMImageOfferID("12345678-1234-9876-4563-123456789012", "locationName", "edgeZoneName", "publisherName", "offerName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVMImageOfferID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VMImageOfferId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &VMImageOfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVMImageOfferID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestParseVMImageOfferIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VMImageOfferId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName", + Expected: &VMImageOfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + EdgeZoneName: "edgeZoneName", + PublisherName: "publisherName", + OfferName: "offerName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/edgeZones/edgeZoneName/publishers/publisherName/artifactTypes/vmImage/offers/offerName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe", + Expected: &VMImageOfferId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + EdgeZoneName: "eDgEzOnEnAmE", + PublisherName: "pUbLiShErNaMe", + OfferName: "oFfErNaMe", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/eDgEzOnEs/eDgEzOnEnAmE/pUbLiShErS/pUbLiShErNaMe/aRtIfAcTtYpEs/vMiMaGe/oFfErS/oFfErNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVMImageOfferIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.EdgeZoneName != v.Expected.EdgeZoneName { + t.Fatalf("Expected %q but got %q for EdgeZoneName", v.Expected.EdgeZoneName, actual.EdgeZoneName) + } + + if actual.PublisherName != v.Expected.PublisherName { + t.Fatalf("Expected %q but got %q for PublisherName", v.Expected.PublisherName, actual.PublisherName) + } + + if actual.OfferName != v.Expected.OfferName { + t.Fatalf("Expected %q but got %q for OfferName", v.Expected.OfferName, actual.OfferName) + } + + } +} + +func TestSegmentsForVMImageOfferId(t *testing.T) { + segments := VMImageOfferId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VMImageOfferId 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/compute/2024-11-01/virtualmachineimages/method_edgezoneget.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezoneget.go new file mode 100644 index 00000000000..aae2bc8618d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezoneget.go @@ -0,0 +1,53 @@ +package virtualmachineimages + +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 EdgeZoneGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineImage +} + +// EdgeZoneGet ... +func (c VirtualMachineImagesClient) EdgeZoneGet(ctx context.Context, id OfferSkuVersionId) (result EdgeZoneGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelist.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelist.go new file mode 100644 index 00000000000..70e0120daa1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelist.go @@ -0,0 +1,91 @@ +package virtualmachineimages + +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 EdgeZoneListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +type EdgeZoneListOperationOptions struct { + Expand *string + Orderby *string + Top *int64 +} + +func DefaultEdgeZoneListOperationOptions() EdgeZoneListOperationOptions { + return EdgeZoneListOperationOptions{} +} + +func (o EdgeZoneListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o EdgeZoneListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o EdgeZoneListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// EdgeZoneList ... +func (c VirtualMachineImagesClient) EdgeZoneList(ctx context.Context, id OfferSkuId, options EdgeZoneListOperationOptions) (result EdgeZoneListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/versions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistoffers.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistoffers.go new file mode 100644 index 00000000000..26cde80c448 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistoffers.go @@ -0,0 +1,54 @@ +package virtualmachineimages + +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 EdgeZoneListOffersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// EdgeZoneListOffers ... +func (c VirtualMachineImagesClient) EdgeZoneListOffers(ctx context.Context, id EdgeZonePublisherId) (result EdgeZoneListOffersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/artifactTypes/vmImage/offers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistpublishers.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistpublishers.go new file mode 100644 index 00000000000..2ed9f07750a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistpublishers.go @@ -0,0 +1,54 @@ +package virtualmachineimages + +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 EdgeZoneListPublishersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// EdgeZoneListPublishers ... +func (c VirtualMachineImagesClient) EdgeZoneListPublishers(ctx context.Context, id EdgeZoneId) (result EdgeZoneListPublishersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/publishers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistskus.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistskus.go new file mode 100644 index 00000000000..62b0005efdd --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_edgezonelistskus.go @@ -0,0 +1,54 @@ +package virtualmachineimages + +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 EdgeZoneListSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// EdgeZoneListSkus ... +func (c VirtualMachineImagesClient) EdgeZoneListSkus(ctx context.Context, id VMImageOfferId) (result EdgeZoneListSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_get.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_get.go new file mode 100644 index 00000000000..d9357bbb7dc --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_get.go @@ -0,0 +1,53 @@ +package virtualmachineimages + +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 *VirtualMachineImage +} + +// Get ... +func (c VirtualMachineImagesClient) Get(ctx context.Context, id SkuVersionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineImage + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_list.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_list.go new file mode 100644 index 00000000000..2d6df70703d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_list.go @@ -0,0 +1,91 @@ +package virtualmachineimages + +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 *[]VirtualMachineImageResource +} + +type ListOperationOptions struct { + Expand *string + Orderby *string + Top *int64 +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Orderby != nil { + out.Append("$orderby", fmt.Sprintf("%v", *o.Orderby)) + } + if o.Top != nil { + out.Append("$top", fmt.Sprintf("%v", *o.Top)) + } + return &out +} + +// List ... +func (c VirtualMachineImagesClient) List(ctx context.Context, id SkuId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/versions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_listbyedgezone.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listbyedgezone.go new file mode 100644 index 00000000000..2a0cde9ecfa --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listbyedgezone.go @@ -0,0 +1,105 @@ +package virtualmachineimages + +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 ListByEdgeZoneOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +type ListByEdgeZoneCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineImageResource +} + +type ListByEdgeZoneCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByEdgeZoneCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByEdgeZone ... +func (c VirtualMachineImagesClient) ListByEdgeZone(ctx context.Context, id EdgeZoneId) (result ListByEdgeZoneOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByEdgeZoneCustomPager{}, + Path: fmt.Sprintf("%s/vmimages", 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 *[]VirtualMachineImageResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByEdgeZoneComplete retrieves all the results into a single object +func (c VirtualMachineImagesClient) ListByEdgeZoneComplete(ctx context.Context, id EdgeZoneId) (ListByEdgeZoneCompleteResult, error) { + return c.ListByEdgeZoneCompleteMatchingPredicate(ctx, id, VirtualMachineImageResourceOperationPredicate{}) +} + +// ListByEdgeZoneCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineImagesClient) ListByEdgeZoneCompleteMatchingPredicate(ctx context.Context, id EdgeZoneId, predicate VirtualMachineImageResourceOperationPredicate) (result ListByEdgeZoneCompleteResult, err error) { + items := make([]VirtualMachineImageResource, 0) + + resp, err := c.ListByEdgeZone(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByEdgeZoneCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_listoffers.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listoffers.go new file mode 100644 index 00000000000..b44d982eaaf --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listoffers.go @@ -0,0 +1,54 @@ +package virtualmachineimages + +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 ListOffersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// ListOffers ... +func (c VirtualMachineImagesClient) ListOffers(ctx context.Context, id PublisherId) (result ListOffersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/artifactTypes/vmImage/offers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_listpublishers.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listpublishers.go new file mode 100644 index 00000000000..0251298dfe5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listpublishers.go @@ -0,0 +1,54 @@ +package virtualmachineimages + +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 ListPublishersOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// ListPublishers ... +func (c VirtualMachineImagesClient) ListPublishers(ctx context.Context, id LocationId) (result ListPublishersOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/publishers", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/method_listskus.go b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listskus.go new file mode 100644 index 00000000000..1a3ee479650 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/method_listskus.go @@ -0,0 +1,54 @@ +package virtualmachineimages + +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 ListSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineImageResource +} + +// ListSkus ... +func (c VirtualMachineImagesClient) ListSkus(ctx context.Context, id OfferId) (result ListSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/skus", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model []VirtualMachineImageResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_alternativeoption.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_alternativeoption.go new file mode 100644 index 00000000000..96aee912009 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_alternativeoption.go @@ -0,0 +1,9 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AlternativeOption struct { + Type *AlternativeType `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_automaticosupgradeproperties.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_automaticosupgradeproperties.go new file mode 100644 index 00000000000..8a35402f0f6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_automaticosupgradeproperties.go @@ -0,0 +1,8 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticOSUpgradeProperties struct { + AutomaticOSUpgradeSupported bool `json:"automaticOSUpgradeSupported"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_datadiskimage.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_datadiskimage.go new file mode 100644 index 00000000000..894fae4fcae --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_datadiskimage.go @@ -0,0 +1,8 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDiskImage struct { + Lun *int64 `json:"lun,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_disallowedconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_disallowedconfiguration.go new file mode 100644 index 00000000000..ac18aa83e8d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_disallowedconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DisallowedConfiguration struct { + VMDiskType *VMDiskTypes `json:"vmDiskType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_imagedeprecationstatus.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_imagedeprecationstatus.go new file mode 100644 index 00000000000..7fdda60d55f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_imagedeprecationstatus.go @@ -0,0 +1,28 @@ +package virtualmachineimages + +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 ImageDeprecationStatus struct { + AlternativeOption *AlternativeOption `json:"alternativeOption,omitempty"` + ImageState *ImageState `json:"imageState,omitempty"` + ScheduledDeprecationTime *string `json:"scheduledDeprecationTime,omitempty"` +} + +func (o *ImageDeprecationStatus) GetScheduledDeprecationTimeAsTime() (*time.Time, error) { + if o.ScheduledDeprecationTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ScheduledDeprecationTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *ImageDeprecationStatus) SetScheduledDeprecationTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ScheduledDeprecationTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_osdiskimage.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_osdiskimage.go new file mode 100644 index 00000000000..5d9a484e322 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_osdiskimage.go @@ -0,0 +1,8 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDiskImage struct { + OperatingSystem OperatingSystemTypes `json:"operatingSystem"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_purchaseplan.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_purchaseplan.go new file mode 100644 index 00000000000..5349798395f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_purchaseplan.go @@ -0,0 +1,10 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PurchasePlan struct { + Name string `json:"name"` + Product string `json:"product"` + Publisher string `json:"publisher"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimage.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimage.go new file mode 100644 index 00000000000..45732c95c1f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimage.go @@ -0,0 +1,17 @@ +package virtualmachineimages + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImage struct { + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name string `json:"name"` + Properties *VirtualMachineImageProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimagefeature.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimagefeature.go new file mode 100644 index 00000000000..cc7b127af02 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimagefeature.go @@ -0,0 +1,9 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageFeature struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageproperties.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageproperties.go new file mode 100644 index 00000000000..c6e70e93e00 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageproperties.go @@ -0,0 +1,16 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageProperties struct { + Architecture *ArchitectureTypes `json:"architecture,omitempty"` + AutomaticOSUpgradeProperties *AutomaticOSUpgradeProperties `json:"automaticOSUpgradeProperties,omitempty"` + DataDiskImages *[]DataDiskImage `json:"dataDiskImages,omitempty"` + Disallowed *DisallowedConfiguration `json:"disallowed,omitempty"` + Features *[]VirtualMachineImageFeature `json:"features,omitempty"` + HyperVGeneration *HyperVGenerationTypes `json:"hyperVGeneration,omitempty"` + ImageDeprecationStatus *ImageDeprecationStatus `json:"imageDeprecationStatus,omitempty"` + OsDiskImage *OSDiskImage `json:"osDiskImage,omitempty"` + Plan *PurchasePlan `json:"plan,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageresource.go b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageresource.go new file mode 100644 index 00000000000..052ab65052d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/model_virtualmachineimageresource.go @@ -0,0 +1,16 @@ +package virtualmachineimages + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageResource struct { + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name string `json:"name"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/predicates.go b/resource-manager/compute/2024-11-01/virtualmachineimages/predicates.go new file mode 100644 index 00000000000..1d8403e2541 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/predicates.go @@ -0,0 +1,27 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineImageResourceOperationPredicate struct { + Id *string + Location *string + Name *string +} + +func (p VirtualMachineImageResourceOperationPredicate) Matches(input VirtualMachineImageResource) 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 && *p.Name != input.Name { + return false + } + + return true +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineimages/version.go b/resource-manager/compute/2024-11-01/virtualmachineimages/version.go new file mode 100644 index 00000000000..8eaa118c261 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineimages/version.go @@ -0,0 +1,10 @@ +package virtualmachineimages + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachineimages/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/README.md b/resource-manager/compute/2024-11-01/virtualmachineruncommands/README.md new file mode 100644 index 00000000000..59b96dd16eb --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/README.md @@ -0,0 +1,132 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachineruncommands` Documentation + +The `virtualmachineruncommands` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachineruncommands" +``` + + +### Client Initialization + +```go +client := virtualmachineruncommands.NewVirtualMachineRunCommandsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +payload := virtualmachineruncommands.VirtualMachineRunCommand{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewRunCommandID("12345678-1234-9876-4563-123456789012", "locationName", "commandId") + +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: `VirtualMachineRunCommandsClient.GetByVirtualMachine` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +read, err := client.GetByVirtualMachine(ctx, id, virtualmachineruncommands.DefaultGetByVirtualMachineOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.List` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// 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: `VirtualMachineRunCommandsClient.ListByVirtualMachine` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +// alternatively `client.ListByVirtualMachine(ctx, id, virtualmachineruncommands.DefaultListByVirtualMachineOperationOptions())` can be used to do batched pagination +items, err := client.ListByVirtualMachineComplete(ctx, id, virtualmachineruncommands.DefaultListByVirtualMachineOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineRunCommandsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachineruncommands.NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + +payload := virtualmachineruncommands.VirtualMachineRunCommandUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/client.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/client.go new file mode 100644 index 00000000000..48e134abb29 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/client.go @@ -0,0 +1,26 @@ +package virtualmachineruncommands + +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 VirtualMachineRunCommandsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineRunCommandsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineRunCommandsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachineruncommands", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineRunCommandsClient: %+v", err) + } + + return &VirtualMachineRunCommandsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/constants.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/constants.go new file mode 100644 index 00000000000..9621a92d708 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/constants.go @@ -0,0 +1,151 @@ +package virtualmachineruncommands + +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 ExecutionState string + +const ( + ExecutionStateCanceled ExecutionState = "Canceled" + ExecutionStateFailed ExecutionState = "Failed" + ExecutionStatePending ExecutionState = "Pending" + ExecutionStateRunning ExecutionState = "Running" + ExecutionStateSucceeded ExecutionState = "Succeeded" + ExecutionStateTimedOut ExecutionState = "TimedOut" + ExecutionStateUnknown ExecutionState = "Unknown" +) + +func PossibleValuesForExecutionState() []string { + return []string{ + string(ExecutionStateCanceled), + string(ExecutionStateFailed), + string(ExecutionStatePending), + string(ExecutionStateRunning), + string(ExecutionStateSucceeded), + string(ExecutionStateTimedOut), + string(ExecutionStateUnknown), + } +} + +func (s *ExecutionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExecutionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExecutionState(input string) (*ExecutionState, error) { + vals := map[string]ExecutionState{ + "canceled": ExecutionStateCanceled, + "failed": ExecutionStateFailed, + "pending": ExecutionStatePending, + "running": ExecutionStateRunning, + "succeeded": ExecutionStateSucceeded, + "timedout": ExecutionStateTimedOut, + "unknown": ExecutionStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExecutionState(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location.go new file mode 100644 index 00000000000..f23f00fe4e6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location.go @@ -0,0 +1,121 @@ +package virtualmachineruncommands + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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.Compute/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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/compute/2024-11-01/virtualmachineruncommands/id_location_test.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location_test.go new file mode 100644 index 00000000000..a2db8720398 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_location_test.go @@ -0,0 +1,237 @@ +package virtualmachineruncommands + +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", "locationName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/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/compute/2024-11-01/virtualmachineruncommands/id_runcommand.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand.go new file mode 100644 index 00000000000..64a8edf61a9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand.go @@ -0,0 +1,130 @@ +package virtualmachineruncommands + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&RunCommandId{}) +} + +var _ resourceids.ResourceId = &RunCommandId{} + +// RunCommandId is a struct representing the Resource ID for a Run Command +type RunCommandId struct { + SubscriptionId string + LocationName string + CommandId string +} + +// NewRunCommandID returns a new RunCommandId struct +func NewRunCommandID(subscriptionId string, locationName string, commandId string) RunCommandId { + return RunCommandId{ + SubscriptionId: subscriptionId, + LocationName: locationName, + CommandId: commandId, + } +} + +// ParseRunCommandID parses 'input' into a RunCommandId +func ParseRunCommandID(input string) (*RunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&RunCommandId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseRunCommandIDInsensitively parses 'input' case-insensitively into a RunCommandId +// note: this method should only be used for API response data and not user input +func ParseRunCommandIDInsensitively(input string) (*RunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&RunCommandId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := RunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *RunCommandId) 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.CommandId, ok = input.Parsed["commandId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "commandId", input) + } + + return nil +} + +// ValidateRunCommandID checks that 'input' can be parsed as a Run Command ID +func ValidateRunCommandID(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 := ParseRunCommandID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Run Command ID +func (id RunCommandId) ID() string { + fmtString := "/subscriptions/%s/providers/Microsoft.Compute/locations/%s/runCommands/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.LocationName, id.CommandId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Run Command ID +func (id RunCommandId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + resourceids.StaticSegment("staticRunCommands", "runCommands", "runCommands"), + resourceids.UserSpecifiedSegment("commandId", "commandId"), + } +} + +// String returns a human-readable description of this Run Command ID +func (id RunCommandId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Location Name: %q", id.LocationName), + fmt.Sprintf("Command: %q", id.CommandId), + } + return fmt.Sprintf("Run Command (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand_test.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand_test.go new file mode 100644 index 00000000000..edd76a46cda --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_runcommand_test.go @@ -0,0 +1,282 @@ +package virtualmachineruncommands + +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 = &RunCommandId{} + +func TestNewRunCommandID(t *testing.T) { + id := NewRunCommandID("12345678-1234-9876-4563-123456789012", "locationName", "commandId") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } + + if id.CommandId != "commandId" { + t.Fatalf("Expected %q but got %q for Segment 'CommandId'", id.CommandId, "commandId") + } +} + +func TestFormatRunCommandID(t *testing.T) { + actual := NewRunCommandID("12345678-1234-9876-4563-123456789012", "locationName", "commandId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseRunCommandID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RunCommandId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId", + Expected: &RunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + CommandId: "commandId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRunCommandID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CommandId != v.Expected.CommandId { + t.Fatalf("Expected %q but got %q for CommandId", v.Expected.CommandId, actual.CommandId) + } + + } +} + +func TestParseRunCommandIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *RunCommandId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/rUnCoMmAnDs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId", + Expected: &RunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + CommandId: "commandId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/runCommands/commandId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/rUnCoMmAnDs/cOmMaNdId", + Expected: &RunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + CommandId: "cOmMaNdId", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/rUnCoMmAnDs/cOmMaNdId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseRunCommandIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.CommandId != v.Expected.CommandId { + t.Fatalf("Expected %q but got %q for CommandId", v.Expected.CommandId, actual.CommandId) + } + + } +} + +func TestSegmentsForRunCommandId(t *testing.T) { + segments := RunCommandId{}.Segments() + if len(segments) == 0 { + t.Fatalf("RunCommandId 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/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine.go new file mode 100644 index 00000000000..1ee0639845f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine.go @@ -0,0 +1,130 @@ +package virtualmachineruncommands + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + return nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(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 := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine_test.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine_test.go new file mode 100644 index 00000000000..9be9a3ac5ae --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachine_test.go @@ -0,0 +1,282 @@ +package virtualmachineruncommands + +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 = &VirtualMachineId{} + +func TestNewVirtualMachineID(t *testing.T) { + id := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + + 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.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } +} + +func TestFormatVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestParseVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestSegmentsForVirtualMachineId(t *testing.T) { + segments := VirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineId 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/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go new file mode 100644 index 00000000000..158a3e80bdd --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand.go @@ -0,0 +1,139 @@ +package virtualmachineruncommands + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineRunCommandId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineRunCommandId{} + +// VirtualMachineRunCommandId is a struct representing the Resource ID for a Virtual Machine Run Command +type VirtualMachineRunCommandId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string + RunCommandName string +} + +// NewVirtualMachineRunCommandID returns a new VirtualMachineRunCommandId struct +func NewVirtualMachineRunCommandID(subscriptionId string, resourceGroupName string, virtualMachineName string, runCommandName string) VirtualMachineRunCommandId { + return VirtualMachineRunCommandId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + RunCommandName: runCommandName, + } +} + +// ParseVirtualMachineRunCommandID parses 'input' into a VirtualMachineRunCommandId +func ParseVirtualMachineRunCommandID(input string) (*VirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineRunCommandIDInsensitively parses 'input' case-insensitively into a VirtualMachineRunCommandId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineRunCommandId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) + } + + return nil +} + +// ValidateVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Run Command ID +func ValidateVirtualMachineRunCommandID(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 := ParseVirtualMachineRunCommandID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Run Command ID +func (id VirtualMachineRunCommandId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s/runCommands/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName, id.RunCommandName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Run Command ID +func (id VirtualMachineRunCommandId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + resourceids.StaticSegment("staticRunCommands", "runCommands", "runCommands"), + resourceids.UserSpecifiedSegment("runCommandName", "runCommandName"), + } +} + +// String returns a human-readable description of this Virtual Machine Run Command ID +func (id VirtualMachineRunCommandId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + fmt.Sprintf("Run Command Name: %q", id.RunCommandName), + } + return fmt.Sprintf("Virtual Machine Run Command (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go new file mode 100644 index 00000000000..09a2aec7edd --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/id_virtualmachineruncommand_test.go @@ -0,0 +1,327 @@ +package virtualmachineruncommands + +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 = &VirtualMachineRunCommandId{} + +func TestNewVirtualMachineRunCommandID(t *testing.T) { + id := NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName") + + 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.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } + + if id.RunCommandName != "runCommandName" { + t.Fatalf("Expected %q but got %q for Segment 'RunCommandName'", id.RunCommandName, "runCommandName") + } +} + +func TestFormatVirtualMachineRunCommandID(t *testing.T) { + actual := NewVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName", "runCommandName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineRunCommandID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineRunCommandId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName", + Expected: &VirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineRunCommandID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestParseVirtualMachineRunCommandIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineRunCommandId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/rUnCoMmAnDs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName", + Expected: &VirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/runCommands/runCommandName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/rUnCoMmAnDs/rUnCoMmAnDnAmE", + Expected: &VirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + RunCommandName: "rUnCoMmAnDnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/rUnCoMmAnDs/rUnCoMmAnDnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineRunCommandIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestSegmentsForVirtualMachineRunCommandId(t *testing.T) { + segments := VirtualMachineRunCommandId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineRunCommandId 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/compute/2024-11-01/virtualmachineruncommands/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_createorupdate.go new file mode 100644 index 00000000000..6507e0920af --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachineruncommands + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +// CreateOrUpdate ... +func (c VirtualMachineRunCommandsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommand) (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 VirtualMachineRunCommandsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommand) 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/compute/2024-11-01/virtualmachineruncommands/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_delete.go new file mode 100644 index 00000000000..c1a11a3b561 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachineruncommands + +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 VirtualMachineRunCommandsClient) Delete(ctx context.Context, id VirtualMachineRunCommandId) (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 VirtualMachineRunCommandsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineRunCommandId) 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/compute/2024-11-01/virtualmachineruncommands/method_get.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_get.go new file mode 100644 index 00000000000..465ea8330ad --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_get.go @@ -0,0 +1,53 @@ +package virtualmachineruncommands + +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 *RunCommandDocument +} + +// Get ... +func (c VirtualMachineRunCommandsClient) Get(ctx context.Context, id RunCommandId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RunCommandDocument + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_getbyvirtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_getbyvirtualmachine.go new file mode 100644 index 00000000000..f603e128c0c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_getbyvirtualmachine.go @@ -0,0 +1,83 @@ +package virtualmachineruncommands + +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 GetByVirtualMachineOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +type GetByVirtualMachineOperationOptions struct { + Expand *string +} + +func DefaultGetByVirtualMachineOperationOptions() GetByVirtualMachineOperationOptions { + return GetByVirtualMachineOperationOptions{} +} + +func (o GetByVirtualMachineOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetByVirtualMachineOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetByVirtualMachineOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// GetByVirtualMachine ... +func (c VirtualMachineRunCommandsClient) GetByVirtualMachine(ctx context.Context, id VirtualMachineRunCommandId, options GetByVirtualMachineOperationOptions) (result GetByVirtualMachineOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineRunCommand + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_list.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_list.go new file mode 100644 index 00000000000..6a0102e039f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_list.go @@ -0,0 +1,105 @@ +package virtualmachineruncommands + +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 *[]RunCommandDocumentBase +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []RunCommandDocumentBase +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineRunCommandsClient) List(ctx context.Context, id LocationId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/runCommands", 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 *[]RunCommandDocumentBase `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 VirtualMachineRunCommandsClient) ListComplete(ctx context.Context, id LocationId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, RunCommandDocumentBaseOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineRunCommandsClient) ListCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate RunCommandDocumentBaseOperationPredicate) (result ListCompleteResult, err error) { + items := make([]RunCommandDocumentBase, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_listbyvirtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_listbyvirtualmachine.go new file mode 100644 index 00000000000..739e09cd17f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_listbyvirtualmachine.go @@ -0,0 +1,134 @@ +package virtualmachineruncommands + +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 ListByVirtualMachineOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineRunCommand +} + +type ListByVirtualMachineCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineRunCommand +} + +type ListByVirtualMachineOperationOptions struct { + Expand *string +} + +func DefaultListByVirtualMachineOperationOptions() ListByVirtualMachineOperationOptions { + return ListByVirtualMachineOperationOptions{} +} + +func (o ListByVirtualMachineOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListByVirtualMachineOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListByVirtualMachineOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +type ListByVirtualMachineCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByVirtualMachineCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByVirtualMachine ... +func (c VirtualMachineRunCommandsClient) ListByVirtualMachine(ctx context.Context, id VirtualMachineId, options ListByVirtualMachineOperationOptions) (result ListByVirtualMachineOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListByVirtualMachineCustomPager{}, + Path: fmt.Sprintf("%s/runCommands", 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 *[]VirtualMachineRunCommand `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByVirtualMachineComplete retrieves all the results into a single object +func (c VirtualMachineRunCommandsClient) ListByVirtualMachineComplete(ctx context.Context, id VirtualMachineId, options ListByVirtualMachineOperationOptions) (ListByVirtualMachineCompleteResult, error) { + return c.ListByVirtualMachineCompleteMatchingPredicate(ctx, id, options, VirtualMachineRunCommandOperationPredicate{}) +} + +// ListByVirtualMachineCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineRunCommandsClient) ListByVirtualMachineCompleteMatchingPredicate(ctx context.Context, id VirtualMachineId, options ListByVirtualMachineOperationOptions, predicate VirtualMachineRunCommandOperationPredicate) (result ListByVirtualMachineCompleteResult, err error) { + items := make([]VirtualMachineRunCommand, 0) + + resp, err := c.ListByVirtualMachine(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByVirtualMachineCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_update.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_update.go new file mode 100644 index 00000000000..50ec375b474 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/method_update.go @@ -0,0 +1,74 @@ +package virtualmachineruncommands + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +// Update ... +func (c VirtualMachineRunCommandsClient) Update(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 VirtualMachineRunCommandsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) 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/compute/2024-11-01/virtualmachineruncommands/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_instanceviewstatus.go new file mode 100644 index 00000000000..dc520cf9a16 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachineruncommands + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocument.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocument.go new file mode 100644 index 00000000000..d438a067161 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocument.go @@ -0,0 +1,14 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandDocument struct { + Description string `json:"description"` + Id string `json:"id"` + Label string `json:"label"` + OsType OperatingSystemTypes `json:"osType"` + Parameters *[]RunCommandParameterDefinition `json:"parameters,omitempty"` + Schema string `json:"$schema"` + Script []string `json:"script"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocumentbase.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocumentbase.go new file mode 100644 index 00000000000..5532a78d531 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommanddocumentbase.go @@ -0,0 +1,12 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandDocumentBase struct { + Description string `json:"description"` + Id string `json:"id"` + Label string `json:"label"` + OsType OperatingSystemTypes `json:"osType"` + Schema string `json:"$schema"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandinputparameter.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandinputparameter.go new file mode 100644 index 00000000000..f95d29616c9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandmanagedidentity.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandmanagedidentity.go new file mode 100644 index 00000000000..ee70096b558 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandmanagedidentity.go @@ -0,0 +1,9 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandManagedIdentity struct { + ClientId *string `json:"clientId,omitempty"` + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandparameterdefinition.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandparameterdefinition.go new file mode 100644 index 00000000000..fb8ced1f5a1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_runcommandparameterdefinition.go @@ -0,0 +1,11 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandParameterDefinition struct { + DefaultValue *string `json:"defaultValue,omitempty"` + Name string `json:"name"` + Required *bool `json:"required,omitempty"` + Type string `json:"type"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommand.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommand.go new file mode 100644 index 00000000000..e9c4654eff0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommand.go @@ -0,0 +1,13 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommand struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go new file mode 100644 index 00000000000..d5d051e09a1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandinstanceview.go @@ -0,0 +1,45 @@ +package virtualmachineruncommands + +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 VirtualMachineRunCommandInstanceView struct { + EndTime *string `json:"endTime,omitempty"` + Error *string `json:"error,omitempty"` + ExecutionMessage *string `json:"executionMessage,omitempty"` + ExecutionState *ExecutionState `json:"executionState,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + Output *string `json:"output,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +func (o *VirtualMachineRunCommandInstanceView) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *VirtualMachineRunCommandInstanceView) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go new file mode 100644 index 00000000000..dea84642c36 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandproperties.go @@ -0,0 +1,21 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandProperties struct { + AsyncExecution *bool `json:"asyncExecution,omitempty"` + ErrorBlobManagedIdentity *RunCommandManagedIdentity `json:"errorBlobManagedIdentity,omitempty"` + ErrorBlobUri *string `json:"errorBlobUri,omitempty"` + InstanceView *VirtualMachineRunCommandInstanceView `json:"instanceView,omitempty"` + OutputBlobManagedIdentity *RunCommandManagedIdentity `json:"outputBlobManagedIdentity,omitempty"` + OutputBlobUri *string `json:"outputBlobUri,omitempty"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + ProtectedParameters *[]RunCommandInputParameter `json:"protectedParameters,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RunAsPassword *string `json:"runAsPassword,omitempty"` + RunAsUser *string `json:"runAsUser,omitempty"` + Source *VirtualMachineRunCommandScriptSource `json:"source,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go new file mode 100644 index 00000000000..e1f8d5b5314 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandscriptsource.go @@ -0,0 +1,11 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandScriptSource struct { + CommandId *string `json:"commandId,omitempty"` + Script *string `json:"script,omitempty"` + ScriptUri *string `json:"scriptUri,omitempty"` + ScriptUriManagedIdentity *RunCommandManagedIdentity `json:"scriptUriManagedIdentity,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go new file mode 100644 index 00000000000..b8440a0baa2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/model_virtualmachineruncommandupdate.go @@ -0,0 +1,9 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandUpdate struct { + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachineruncommands/predicates.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/predicates.go new file mode 100644 index 00000000000..80b5a5e96e9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/predicates.go @@ -0,0 +1,60 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandDocumentBaseOperationPredicate struct { + Description *string + Id *string + Label *string + Schema *string +} + +func (p RunCommandDocumentBaseOperationPredicate) Matches(input RunCommandDocumentBase) bool { + + if p.Description != nil && *p.Description != input.Description { + return false + } + + if p.Id != nil && *p.Id != input.Id { + return false + } + + if p.Label != nil && *p.Label != input.Label { + return false + } + + if p.Schema != nil && *p.Schema != input.Schema { + return false + } + + return true +} + +type VirtualMachineRunCommandOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineRunCommandOperationPredicate) Matches(input VirtualMachineRunCommand) 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/compute/2024-11-01/virtualmachineruncommands/version.go b/resource-manager/compute/2024-11-01/virtualmachineruncommands/version.go new file mode 100644 index 00000000000..0b41ecbe233 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachineruncommands/version.go @@ -0,0 +1,10 @@ +package virtualmachineruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachineruncommands/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/README.md b/resource-manager/compute/2024-11-01/virtualmachines/README.md new file mode 100644 index 00000000000..5e1953297c5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/README.md @@ -0,0 +1,424 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachines` Documentation + +The `virtualmachines` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachines" +``` + + +### Client Initialization + +```go +client := virtualmachines.NewVirtualMachinesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachinesClient.AssessPatches` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.AssessPatchesThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.AttachDetachDataDisks` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.AttachDetachDataDisksRequest{ + // ... +} + + +if err := client.AttachDetachDataDisksThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Capture` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineCaptureParameters{ + // ... +} + + +if err := client.CaptureThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.ConvertToManagedDisks` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.ConvertToManagedDisksThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachine{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, virtualmachines.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Deallocate` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.DeallocateThenPoll(ctx, id, virtualmachines.DefaultDeallocateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.DeleteThenPoll(ctx, id, virtualmachines.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Generalize` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.Generalize(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.Get(ctx, id, virtualmachines.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.InstallPatches` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineInstallPatchesParameters{ + // ... +} + + +if err := client.InstallPatchesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.InstanceView` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.InstanceView(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.List(ctx, id, virtualmachines.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachines.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.ListAll` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id, virtualmachines.DefaultListAllOperationOptions())` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id, virtualmachines.DefaultListAllOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.ListAvailableSizes` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.ListAvailableSizes(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.ListByLocation` + +```go +ctx := context.TODO() +id := virtualmachines.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachinesClient.MigrateToVMScaleSet` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.MigrateVMToVirtualMachineScaleSetInput{ + // ... +} + + +if err := client.MigrateToVMScaleSetThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.PerformMaintenance` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.PerformMaintenanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.PowerOff` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.PowerOffThenPoll(ctx, id, virtualmachines.DefaultPowerOffOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Reapply` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.ReapplyThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Reimage` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineReimageParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.RetrieveBootDiagnosticsData` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.RetrieveBootDiagnosticsData(ctx, id, virtualmachines.DefaultRetrieveBootDiagnosticsDataOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.RunCommand` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.RunCommandInput{ + // ... +} + + +if err := client.RunCommandThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.SimulateEviction` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +read, err := client.SimulateEviction(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachinesClient.Start` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachinesClient.Update` + +```go +ctx := context.TODO() +id := virtualmachines.NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + +payload := virtualmachines.VirtualMachineUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualmachines.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachines/client.go b/resource-manager/compute/2024-11-01/virtualmachines/client.go new file mode 100644 index 00000000000..51127106436 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/client.go @@ -0,0 +1,26 @@ +package virtualmachines + +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 VirtualMachinesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachinesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachinesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachines", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachinesClient: %+v", err) + } + + return &VirtualMachinesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/constants.go b/resource-manager/compute/2024-11-01/virtualmachines/constants.go new file mode 100644 index 00000000000..ca63e114637 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/constants.go @@ -0,0 +1,2675 @@ +package virtualmachines + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentNames string + +const ( + ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentNames() []string { + return []string{ + string(ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentNames(input string) (*ComponentNames, error) { + vals := map[string]ComponentNames{ + "microsoft-windows-shell-setup": ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentNames(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DiskDetachOptionTypes string + +const ( + DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach" +) + +func PossibleValuesForDiskDetachOptionTypes() []string { + return []string{ + string(DiskDetachOptionTypesForceDetach), + } +} + +func (s *DiskDetachOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDetachOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDetachOptionTypes(input string) (*DiskDetachOptionTypes, error) { + vals := map[string]DiskDetachOptionTypes{ + "forcedetach": DiskDetachOptionTypesForceDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDetachOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type ExpandTypeForListVMs string + +const ( + ExpandTypeForListVMsInstanceView ExpandTypeForListVMs = "instanceView" +) + +func PossibleValuesForExpandTypeForListVMs() []string { + return []string{ + string(ExpandTypeForListVMsInstanceView), + } +} + +func (s *ExpandTypeForListVMs) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypeForListVMs(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypeForListVMs(input string) (*ExpandTypeForListVMs, error) { + vals := map[string]ExpandTypeForListVMs{ + "instanceview": ExpandTypeForListVMsInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypeForListVMs(input) + return &out, nil +} + +type ExpandTypesForListVMs string + +const ( + ExpandTypesForListVMsInstanceView ExpandTypesForListVMs = "instanceView" +) + +func PossibleValuesForExpandTypesForListVMs() []string { + return []string{ + string(ExpandTypesForListVMsInstanceView), + } +} + +func (s *ExpandTypesForListVMs) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypesForListVMs(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypesForListVMs(input string) (*ExpandTypesForListVMs, error) { + vals := map[string]ExpandTypesForListVMs{ + "instanceview": ExpandTypesForListVMsInstanceView, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypesForListVMs(input) + return &out, nil +} + +type HyperVGenerationType string + +const ( + HyperVGenerationTypeVOne HyperVGenerationType = "V1" + HyperVGenerationTypeVTwo HyperVGenerationType = "V2" +) + +func PossibleValuesForHyperVGenerationType() []string { + return []string{ + string(HyperVGenerationTypeVOne), + string(HyperVGenerationTypeVTwo), + } +} + +func (s *HyperVGenerationType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGenerationType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGenerationType(input string) (*HyperVGenerationType, error) { + vals := map[string]HyperVGenerationType{ + "v1": HyperVGenerationTypeVOne, + "v2": HyperVGenerationTypeVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGenerationType(input) + return &out, nil +} + +type IPVersions string + +const ( + IPVersionsIPvFour IPVersions = "IPv4" + IPVersionsIPvSix IPVersions = "IPv6" +) + +func PossibleValuesForIPVersions() []string { + return []string{ + string(IPVersionsIPvFour), + string(IPVersionsIPvSix), + } +} + +func (s *IPVersions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersions(input string) (*IPVersions, error) { + vals := map[string]IPVersions{ + "ipv4": IPVersionsIPvFour, + "ipv6": IPVersionsIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersions(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type MaintenanceOperationResultCodeTypes string + +const ( + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +func PossibleValuesForMaintenanceOperationResultCodeTypes() []string { + return []string{ + string(MaintenanceOperationResultCodeTypesMaintenanceAborted), + string(MaintenanceOperationResultCodeTypesMaintenanceCompleted), + string(MaintenanceOperationResultCodeTypesNone), + string(MaintenanceOperationResultCodeTypesRetryLater), + } +} + +func (s *MaintenanceOperationResultCodeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceOperationResultCodeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMaintenanceOperationResultCodeTypes(input string) (*MaintenanceOperationResultCodeTypes, error) { + vals := map[string]MaintenanceOperationResultCodeTypes{ + "maintenanceaborted": MaintenanceOperationResultCodeTypesMaintenanceAborted, + "maintenancecompleted": MaintenanceOperationResultCodeTypesMaintenanceCompleted, + "none": MaintenanceOperationResultCodeTypesNone, + "retrylater": MaintenanceOperationResultCodeTypesRetryLater, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceOperationResultCodeTypes(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type PassNames string + +const ( + PassNamesOobeSystem PassNames = "OobeSystem" +) + +func PossibleValuesForPassNames() []string { + return []string{ + string(PassNamesOobeSystem), + } +} + +func (s *PassNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassNames(input string) (*PassNames, error) { + vals := map[string]PassNames{ + "oobesystem": PassNamesOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassNames(input) + return &out, nil +} + +type PatchAssessmentState string + +const ( + PatchAssessmentStateAvailable PatchAssessmentState = "Available" + PatchAssessmentStateUnknown PatchAssessmentState = "Unknown" +) + +func PossibleValuesForPatchAssessmentState() []string { + return []string{ + string(PatchAssessmentStateAvailable), + string(PatchAssessmentStateUnknown), + } +} + +func (s *PatchAssessmentState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchAssessmentState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchAssessmentState(input string) (*PatchAssessmentState, error) { + vals := map[string]PatchAssessmentState{ + "available": PatchAssessmentStateAvailable, + "unknown": PatchAssessmentStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchAssessmentState(input) + return &out, nil +} + +type PatchInstallationState string + +const ( + PatchInstallationStateExcluded PatchInstallationState = "Excluded" + PatchInstallationStateFailed PatchInstallationState = "Failed" + PatchInstallationStateInstalled PatchInstallationState = "Installed" + PatchInstallationStateNotSelected PatchInstallationState = "NotSelected" + PatchInstallationStatePending PatchInstallationState = "Pending" + PatchInstallationStateUnknown PatchInstallationState = "Unknown" +) + +func PossibleValuesForPatchInstallationState() []string { + return []string{ + string(PatchInstallationStateExcluded), + string(PatchInstallationStateFailed), + string(PatchInstallationStateInstalled), + string(PatchInstallationStateNotSelected), + string(PatchInstallationStatePending), + string(PatchInstallationStateUnknown), + } +} + +func (s *PatchInstallationState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchInstallationState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchInstallationState(input string) (*PatchInstallationState, error) { + vals := map[string]PatchInstallationState{ + "excluded": PatchInstallationStateExcluded, + "failed": PatchInstallationStateFailed, + "installed": PatchInstallationStateInstalled, + "notselected": PatchInstallationStateNotSelected, + "pending": PatchInstallationStatePending, + "unknown": PatchInstallationStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchInstallationState(input) + return &out, nil +} + +type PatchOperationStatus string + +const ( + PatchOperationStatusCompletedWithWarnings PatchOperationStatus = "CompletedWithWarnings" + PatchOperationStatusFailed PatchOperationStatus = "Failed" + PatchOperationStatusInProgress PatchOperationStatus = "InProgress" + PatchOperationStatusSucceeded PatchOperationStatus = "Succeeded" + PatchOperationStatusUnknown PatchOperationStatus = "Unknown" +) + +func PossibleValuesForPatchOperationStatus() []string { + return []string{ + string(PatchOperationStatusCompletedWithWarnings), + string(PatchOperationStatusFailed), + string(PatchOperationStatusInProgress), + string(PatchOperationStatusSucceeded), + string(PatchOperationStatusUnknown), + } +} + +func (s *PatchOperationStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePatchOperationStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePatchOperationStatus(input string) (*PatchOperationStatus, error) { + vals := map[string]PatchOperationStatus{ + "completedwithwarnings": PatchOperationStatusCompletedWithWarnings, + "failed": PatchOperationStatusFailed, + "inprogress": PatchOperationStatusInProgress, + "succeeded": PatchOperationStatusSucceeded, + "unknown": PatchOperationStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PatchOperationStatus(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type PublicIPAllocationMethod string + +const ( + PublicIPAllocationMethodDynamic PublicIPAllocationMethod = "Dynamic" + PublicIPAllocationMethodStatic PublicIPAllocationMethod = "Static" +) + +func PossibleValuesForPublicIPAllocationMethod() []string { + return []string{ + string(PublicIPAllocationMethodDynamic), + string(PublicIPAllocationMethodStatic), + } +} + +func (s *PublicIPAllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAllocationMethod(input string) (*PublicIPAllocationMethod, error) { + vals := map[string]PublicIPAllocationMethod{ + "dynamic": PublicIPAllocationMethodDynamic, + "static": PublicIPAllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAllocationMethod(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VMGuestPatchClassificationLinux string + +const ( + VMGuestPatchClassificationLinuxCritical VMGuestPatchClassificationLinux = "Critical" + VMGuestPatchClassificationLinuxOther VMGuestPatchClassificationLinux = "Other" + VMGuestPatchClassificationLinuxSecurity VMGuestPatchClassificationLinux = "Security" +) + +func PossibleValuesForVMGuestPatchClassificationLinux() []string { + return []string{ + string(VMGuestPatchClassificationLinuxCritical), + string(VMGuestPatchClassificationLinuxOther), + string(VMGuestPatchClassificationLinuxSecurity), + } +} + +func (s *VMGuestPatchClassificationLinux) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchClassificationLinux(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchClassificationLinux(input string) (*VMGuestPatchClassificationLinux, error) { + vals := map[string]VMGuestPatchClassificationLinux{ + "critical": VMGuestPatchClassificationLinuxCritical, + "other": VMGuestPatchClassificationLinuxOther, + "security": VMGuestPatchClassificationLinuxSecurity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchClassificationLinux(input) + return &out, nil +} + +type VMGuestPatchClassificationWindows string + +const ( + VMGuestPatchClassificationWindowsCritical VMGuestPatchClassificationWindows = "Critical" + VMGuestPatchClassificationWindowsDefinition VMGuestPatchClassificationWindows = "Definition" + VMGuestPatchClassificationWindowsFeaturePack VMGuestPatchClassificationWindows = "FeaturePack" + VMGuestPatchClassificationWindowsSecurity VMGuestPatchClassificationWindows = "Security" + VMGuestPatchClassificationWindowsServicePack VMGuestPatchClassificationWindows = "ServicePack" + VMGuestPatchClassificationWindowsTools VMGuestPatchClassificationWindows = "Tools" + VMGuestPatchClassificationWindowsUpdateRollUp VMGuestPatchClassificationWindows = "UpdateRollUp" + VMGuestPatchClassificationWindowsUpdates VMGuestPatchClassificationWindows = "Updates" +) + +func PossibleValuesForVMGuestPatchClassificationWindows() []string { + return []string{ + string(VMGuestPatchClassificationWindowsCritical), + string(VMGuestPatchClassificationWindowsDefinition), + string(VMGuestPatchClassificationWindowsFeaturePack), + string(VMGuestPatchClassificationWindowsSecurity), + string(VMGuestPatchClassificationWindowsServicePack), + string(VMGuestPatchClassificationWindowsTools), + string(VMGuestPatchClassificationWindowsUpdateRollUp), + string(VMGuestPatchClassificationWindowsUpdates), + } +} + +func (s *VMGuestPatchClassificationWindows) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchClassificationWindows(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchClassificationWindows(input string) (*VMGuestPatchClassificationWindows, error) { + vals := map[string]VMGuestPatchClassificationWindows{ + "critical": VMGuestPatchClassificationWindowsCritical, + "definition": VMGuestPatchClassificationWindowsDefinition, + "featurepack": VMGuestPatchClassificationWindowsFeaturePack, + "security": VMGuestPatchClassificationWindowsSecurity, + "servicepack": VMGuestPatchClassificationWindowsServicePack, + "tools": VMGuestPatchClassificationWindowsTools, + "updaterollup": VMGuestPatchClassificationWindowsUpdateRollUp, + "updates": VMGuestPatchClassificationWindowsUpdates, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchClassificationWindows(input) + return &out, nil +} + +type VMGuestPatchRebootBehavior string + +const ( + VMGuestPatchRebootBehaviorAlwaysRequiresReboot VMGuestPatchRebootBehavior = "AlwaysRequiresReboot" + VMGuestPatchRebootBehaviorCanRequestReboot VMGuestPatchRebootBehavior = "CanRequestReboot" + VMGuestPatchRebootBehaviorNeverReboots VMGuestPatchRebootBehavior = "NeverReboots" + VMGuestPatchRebootBehaviorUnknown VMGuestPatchRebootBehavior = "Unknown" +) + +func PossibleValuesForVMGuestPatchRebootBehavior() []string { + return []string{ + string(VMGuestPatchRebootBehaviorAlwaysRequiresReboot), + string(VMGuestPatchRebootBehaviorCanRequestReboot), + string(VMGuestPatchRebootBehaviorNeverReboots), + string(VMGuestPatchRebootBehaviorUnknown), + } +} + +func (s *VMGuestPatchRebootBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchRebootBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchRebootBehavior(input string) (*VMGuestPatchRebootBehavior, error) { + vals := map[string]VMGuestPatchRebootBehavior{ + "alwaysrequiresreboot": VMGuestPatchRebootBehaviorAlwaysRequiresReboot, + "canrequestreboot": VMGuestPatchRebootBehaviorCanRequestReboot, + "neverreboots": VMGuestPatchRebootBehaviorNeverReboots, + "unknown": VMGuestPatchRebootBehaviorUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchRebootBehavior(input) + return &out, nil +} + +type VMGuestPatchRebootSetting string + +const ( + VMGuestPatchRebootSettingAlways VMGuestPatchRebootSetting = "Always" + VMGuestPatchRebootSettingIfRequired VMGuestPatchRebootSetting = "IfRequired" + VMGuestPatchRebootSettingNever VMGuestPatchRebootSetting = "Never" +) + +func PossibleValuesForVMGuestPatchRebootSetting() []string { + return []string{ + string(VMGuestPatchRebootSettingAlways), + string(VMGuestPatchRebootSettingIfRequired), + string(VMGuestPatchRebootSettingNever), + } +} + +func (s *VMGuestPatchRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchRebootSetting(input string) (*VMGuestPatchRebootSetting, error) { + vals := map[string]VMGuestPatchRebootSetting{ + "always": VMGuestPatchRebootSettingAlways, + "ifrequired": VMGuestPatchRebootSettingIfRequired, + "never": VMGuestPatchRebootSettingNever, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchRebootSetting(input) + return &out, nil +} + +type VMGuestPatchRebootStatus string + +const ( + VMGuestPatchRebootStatusCompleted VMGuestPatchRebootStatus = "Completed" + VMGuestPatchRebootStatusFailed VMGuestPatchRebootStatus = "Failed" + VMGuestPatchRebootStatusNotNeeded VMGuestPatchRebootStatus = "NotNeeded" + VMGuestPatchRebootStatusRequired VMGuestPatchRebootStatus = "Required" + VMGuestPatchRebootStatusStarted VMGuestPatchRebootStatus = "Started" + VMGuestPatchRebootStatusUnknown VMGuestPatchRebootStatus = "Unknown" +) + +func PossibleValuesForVMGuestPatchRebootStatus() []string { + return []string{ + string(VMGuestPatchRebootStatusCompleted), + string(VMGuestPatchRebootStatusFailed), + string(VMGuestPatchRebootStatusNotNeeded), + string(VMGuestPatchRebootStatusRequired), + string(VMGuestPatchRebootStatusStarted), + string(VMGuestPatchRebootStatusUnknown), + } +} + +func (s *VMGuestPatchRebootStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVMGuestPatchRebootStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVMGuestPatchRebootStatus(input string) (*VMGuestPatchRebootStatus, error) { + vals := map[string]VMGuestPatchRebootStatus{ + "completed": VMGuestPatchRebootStatusCompleted, + "failed": VMGuestPatchRebootStatusFailed, + "notneeded": VMGuestPatchRebootStatusNotNeeded, + "required": VMGuestPatchRebootStatusRequired, + "started": VMGuestPatchRebootStatusStarted, + "unknown": VMGuestPatchRebootStatusUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VMGuestPatchRebootStatus(input) + return &out, nil +} + +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +func PossibleValuesForVirtualMachineEvictionPolicyTypes() []string { + return []string{ + string(VirtualMachineEvictionPolicyTypesDeallocate), + string(VirtualMachineEvictionPolicyTypesDelete), + } +} + +func (s *VirtualMachineEvictionPolicyTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineEvictionPolicyTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineEvictionPolicyTypes(input string) (*VirtualMachineEvictionPolicyTypes, error) { + vals := map[string]VirtualMachineEvictionPolicyTypes{ + "deallocate": VirtualMachineEvictionPolicyTypesDeallocate, + "delete": VirtualMachineEvictionPolicyTypesDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineEvictionPolicyTypes(input) + return &out, nil +} + +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +func PossibleValuesForVirtualMachinePriorityTypes() []string { + return []string{ + string(VirtualMachinePriorityTypesLow), + string(VirtualMachinePriorityTypesRegular), + string(VirtualMachinePriorityTypesSpot), + } +} + +func (s *VirtualMachinePriorityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachinePriorityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachinePriorityTypes(input string) (*VirtualMachinePriorityTypes, error) { + vals := map[string]VirtualMachinePriorityTypes{ + "low": VirtualMachinePriorityTypesLow, + "regular": VirtualMachinePriorityTypesRegular, + "spot": VirtualMachinePriorityTypesSpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachinePriorityTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} + +type ZonePlacementPolicyType string + +const ( + ZonePlacementPolicyTypeAny ZonePlacementPolicyType = "Any" +) + +func PossibleValuesForZonePlacementPolicyType() []string { + return []string{ + string(ZonePlacementPolicyTypeAny), + } +} + +func (s *ZonePlacementPolicyType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonePlacementPolicyType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonePlacementPolicyType(input string) (*ZonePlacementPolicyType, error) { + vals := map[string]ZonePlacementPolicyType{ + "any": ZonePlacementPolicyTypeAny, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonePlacementPolicyType(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/id_location.go b/resource-manager/compute/2024-11-01/virtualmachines/id_location.go new file mode 100644 index 00000000000..64438c96c4f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/id_location.go @@ -0,0 +1,121 @@ +package virtualmachines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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.Compute/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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/compute/2024-11-01/virtualmachines/id_location_test.go b/resource-manager/compute/2024-11-01/virtualmachines/id_location_test.go new file mode 100644 index 00000000000..08322a2d3e4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/id_location_test.go @@ -0,0 +1,237 @@ +package virtualmachines + +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", "locationName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/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/compute/2024-11-01/virtualmachines/id_virtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine.go new file mode 100644 index 00000000000..69a7bb18c41 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine.go @@ -0,0 +1,130 @@ +package virtualmachines + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineId{} + +// VirtualMachineId is a struct representing the Resource ID for a Virtual Machine +type VirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineName string +} + +// NewVirtualMachineID returns a new VirtualMachineId struct +func NewVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineName string) VirtualMachineId { + return VirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineName: virtualMachineName, + } +} + +// ParseVirtualMachineID parses 'input' into a VirtualMachineId +func ParseVirtualMachineID(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineIDInsensitively(input string) (*VirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineId) 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.VirtualMachineName, ok = input.Parsed["virtualMachineName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineName", input) + } + + return nil +} + +// ValidateVirtualMachineID checks that 'input' can be parsed as a Virtual Machine ID +func ValidateVirtualMachineID(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 := ParseVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine ID +func (id VirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine ID +func (id VirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("virtualMachineName", "virtualMachineName"), + } +} + +// String returns a human-readable description of this Virtual Machine ID +func (id VirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Name: %q", id.VirtualMachineName), + } + return fmt.Sprintf("Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine_test.go b/resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine_test.go new file mode 100644 index 00000000000..c2266a5c640 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/id_virtualmachine_test.go @@ -0,0 +1,282 @@ +package virtualmachines + +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 = &VirtualMachineId{} + +func TestNewVirtualMachineID(t *testing.T) { + id := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName") + + 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.VirtualMachineName != "virtualMachineName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineName'", id.VirtualMachineName, "virtualMachineName") + } +} + +func TestFormatVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestParseVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineName: "virtualMachineName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachines/virtualMachineName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE", + Expected: &VirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineName: "vIrTuAlMaChInEnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEs/vIrTuAlMaChInEnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineName != v.Expected.VirtualMachineName { + t.Fatalf("Expected %q but got %q for VirtualMachineName", v.Expected.VirtualMachineName, actual.VirtualMachineName) + } + + } +} + +func TestSegmentsForVirtualMachineId(t *testing.T) { + segments := VirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineId 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/compute/2024-11-01/virtualmachines/method_assesspatches.go b/resource-manager/compute/2024-11-01/virtualmachines/method_assesspatches.go new file mode 100644 index 00000000000..8afe543212e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_assesspatches.go @@ -0,0 +1,71 @@ +package virtualmachines + +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 AssessPatchesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineAssessPatchesResult +} + +// AssessPatches ... +func (c VirtualMachinesClient) AssessPatches(ctx context.Context, id VirtualMachineId) (result AssessPatchesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/assessPatches", 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 +} + +// AssessPatchesThenPoll performs AssessPatches then polls until it's completed +func (c VirtualMachinesClient) AssessPatchesThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.AssessPatches(ctx, id) + if err != nil { + return fmt.Errorf("performing AssessPatches: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AssessPatches: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_attachdetachdatadisks.go b/resource-manager/compute/2024-11-01/virtualmachines/method_attachdetachdatadisks.go new file mode 100644 index 00000000000..214b62f377c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_attachdetachdatadisks.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 AttachDetachDataDisksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *StorageProfile +} + +// AttachDetachDataDisks ... +func (c VirtualMachinesClient) AttachDetachDataDisks(ctx context.Context, id VirtualMachineId, input AttachDetachDataDisksRequest) (result AttachDetachDataDisksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attachDetachDataDisks", 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 +} + +// AttachDetachDataDisksThenPoll performs AttachDetachDataDisks then polls until it's completed +func (c VirtualMachinesClient) AttachDetachDataDisksThenPoll(ctx context.Context, id VirtualMachineId, input AttachDetachDataDisksRequest) error { + result, err := c.AttachDetachDataDisks(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AttachDetachDataDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AttachDetachDataDisks: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_capture.go b/resource-manager/compute/2024-11-01/virtualmachines/method_capture.go new file mode 100644 index 00000000000..a5e6496cb66 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_capture.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 CaptureOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineCaptureResult +} + +// Capture ... +func (c VirtualMachinesClient) Capture(ctx context.Context, id VirtualMachineId, input VirtualMachineCaptureParameters) (result CaptureOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/capture", 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 +} + +// CaptureThenPoll performs Capture then polls until it's completed +func (c VirtualMachinesClient) CaptureThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineCaptureParameters) error { + result, err := c.Capture(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Capture: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Capture: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_converttomanageddisks.go b/resource-manager/compute/2024-11-01/virtualmachines/method_converttomanageddisks.go new file mode 100644 index 00000000000..8c81abc13ac --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_converttomanageddisks.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 ConvertToManagedDisksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ConvertToManagedDisks ... +func (c VirtualMachinesClient) ConvertToManagedDisks(ctx context.Context, id VirtualMachineId) (result ConvertToManagedDisksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/convertToManagedDisks", 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 +} + +// ConvertToManagedDisksThenPoll performs ConvertToManagedDisks then polls until it's completed +func (c VirtualMachinesClient) ConvertToManagedDisksThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.ConvertToManagedDisks(ctx, id) + if err != nil { + return fmt.Errorf("performing ConvertToManagedDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ConvertToManagedDisks: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachines/method_createorupdate.go new file mode 100644 index 00000000000..cce467977a6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_createorupdate.go @@ -0,0 +1,108 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachine +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c VirtualMachinesClient) CreateOrUpdate(ctx context.Context, id VirtualMachineId, input VirtualMachine, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 VirtualMachinesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachine, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/compute/2024-11-01/virtualmachines/method_deallocate.go b/resource-manager/compute/2024-11-01/virtualmachines/method_deallocate.go new file mode 100644 index 00000000000..c962480de36 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_deallocate.go @@ -0,0 +1,99 @@ +package virtualmachines + +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 DeallocateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeallocateOperationOptions struct { + Hibernate *bool +} + +func DefaultDeallocateOperationOptions() DeallocateOperationOptions { + return DeallocateOperationOptions{} +} + +func (o DeallocateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeallocateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeallocateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Hibernate != nil { + out.Append("hibernate", fmt.Sprintf("%v", *o.Hibernate)) + } + return &out +} + +// Deallocate ... +func (c VirtualMachinesClient) Deallocate(ctx context.Context, id VirtualMachineId, options DeallocateOperationOptions) (result DeallocateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/deallocate", 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 +} + +// DeallocateThenPoll performs Deallocate then polls until it's completed +func (c VirtualMachinesClient) DeallocateThenPoll(ctx context.Context, id VirtualMachineId, options DeallocateOperationOptions) error { + result, err := c.Deallocate(ctx, id, options) + if err != nil { + return fmt.Errorf("performing Deallocate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deallocate: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachines/method_delete.go new file mode 100644 index 00000000000..e2d145391fa --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_delete.go @@ -0,0 +1,100 @@ +package virtualmachines + +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 { + ForceDeletion *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.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c VirtualMachinesClient) Delete(ctx context.Context, id VirtualMachineId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 VirtualMachinesClient) DeleteThenPoll(ctx context.Context, id VirtualMachineId, 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/compute/2024-11-01/virtualmachines/method_generalize.go b/resource-manager/compute/2024-11-01/virtualmachines/method_generalize.go new file mode 100644 index 00000000000..358c6e17577 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_generalize.go @@ -0,0 +1,47 @@ +package virtualmachines + +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 GeneralizeOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Generalize ... +func (c VirtualMachinesClient) Generalize(ctx context.Context, id VirtualMachineId) (result GeneralizeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generalize", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_get.go b/resource-manager/compute/2024-11-01/virtualmachines/method_get.go new file mode 100644 index 00000000000..610b8728f94 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_get.go @@ -0,0 +1,83 @@ +package virtualmachines + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachine +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachinesClient) Get(ctx context.Context, id VirtualMachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachine + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_installpatches.go b/resource-manager/compute/2024-11-01/virtualmachines/method_installpatches.go new file mode 100644 index 00000000000..aae8d0fa685 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_installpatches.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 InstallPatchesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineInstallPatchesResult +} + +// InstallPatches ... +func (c VirtualMachinesClient) InstallPatches(ctx context.Context, id VirtualMachineId, input VirtualMachineInstallPatchesParameters) (result InstallPatchesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/installPatches", 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 +} + +// InstallPatchesThenPoll performs InstallPatches then polls until it's completed +func (c VirtualMachinesClient) InstallPatchesThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineInstallPatchesParameters) error { + result, err := c.InstallPatches(ctx, id, input) + if err != nil { + return fmt.Errorf("performing InstallPatches: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after InstallPatches: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_instanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/method_instanceview.go new file mode 100644 index 00000000000..735f254f665 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_instanceview.go @@ -0,0 +1,54 @@ +package virtualmachines + +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 InstanceViewOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineInstanceView +} + +// InstanceView ... +func (c VirtualMachinesClient) InstanceView(ctx context.Context, id VirtualMachineId) (result InstanceViewOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/instanceView", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineInstanceView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_list.go b/resource-manager/compute/2024-11-01/virtualmachines/method_list.go new file mode 100644 index 00000000000..64092df3b3a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_list.go @@ -0,0 +1,139 @@ +package virtualmachines + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachine +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachine +} + +type ListOperationOptions struct { + Expand *ExpandTypeForListVMs + Filter *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachinesClient) List(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachines", 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 *[]VirtualMachine `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 VirtualMachinesClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualMachineOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachinesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, options ListOperationOptions, predicate VirtualMachineOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachine, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_listall.go b/resource-manager/compute/2024-11-01/virtualmachines/method_listall.go new file mode 100644 index 00000000000..c5abe6abb74 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_listall.go @@ -0,0 +1,143 @@ +package virtualmachines + +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 ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachine +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachine +} + +type ListAllOperationOptions struct { + Expand *ExpandTypesForListVMs + Filter *string + StatusOnly *string +} + +func DefaultListAllOperationOptions() ListAllOperationOptions { + return ListAllOperationOptions{} +} + +func (o ListAllOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListAllOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListAllOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.StatusOnly != nil { + out.Append("statusOnly", fmt.Sprintf("%v", *o.StatusOnly)) + } + return &out +} + +type ListAllCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAllCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAll ... +func (c VirtualMachinesClient) ListAll(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListAllCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachines", 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 *[]VirtualMachine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c VirtualMachinesClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, options, VirtualMachineOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachinesClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, options ListAllOperationOptions, predicate VirtualMachineOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]VirtualMachine, 0) + + resp, err := c.ListAll(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_listavailablesizes.go b/resource-manager/compute/2024-11-01/virtualmachines/method_listavailablesizes.go new file mode 100644 index 00000000000..f4ad290ed8b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_listavailablesizes.go @@ -0,0 +1,54 @@ +package virtualmachines + +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 ListAvailableSizesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineSizeListResult +} + +// ListAvailableSizes ... +func (c VirtualMachinesClient) ListAvailableSizes(ctx context.Context, id VirtualMachineId) (result ListAvailableSizesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/vmSizes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineSizeListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_listbylocation.go b/resource-manager/compute/2024-11-01/virtualmachines/method_listbylocation.go new file mode 100644 index 00000000000..a06b8ffe0f2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_listbylocation.go @@ -0,0 +1,105 @@ +package virtualmachines + +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 ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachine +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachine +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c VirtualMachinesClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/virtualMachines", 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 *[]VirtualMachine `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c VirtualMachinesClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, VirtualMachineOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachinesClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate VirtualMachineOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]VirtualMachine, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_migratetovmscaleset.go b/resource-manager/compute/2024-11-01/virtualmachines/method_migratetovmscaleset.go new file mode 100644 index 00000000000..eaed7ed5751 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_migratetovmscaleset.go @@ -0,0 +1,73 @@ +package virtualmachines + +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 MigrateToVMScaleSetOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// MigrateToVMScaleSet ... +func (c VirtualMachinesClient) MigrateToVMScaleSet(ctx context.Context, id VirtualMachineId, input MigrateVMToVirtualMachineScaleSetInput) (result MigrateToVMScaleSetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/migrateToVirtualMachineScaleSet", 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 +} + +// MigrateToVMScaleSetThenPoll performs MigrateToVMScaleSet then polls until it's completed +func (c VirtualMachinesClient) MigrateToVMScaleSetThenPoll(ctx context.Context, id VirtualMachineId, input MigrateVMToVirtualMachineScaleSetInput) error { + result, err := c.MigrateToVMScaleSet(ctx, id, input) + if err != nil { + return fmt.Errorf("performing MigrateToVMScaleSet: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after MigrateToVMScaleSet: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_performmaintenance.go b/resource-manager/compute/2024-11-01/virtualmachines/method_performmaintenance.go new file mode 100644 index 00000000000..bc7aac1c9fd --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_performmaintenance.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 PerformMaintenanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PerformMaintenance ... +func (c VirtualMachinesClient) PerformMaintenance(ctx context.Context, id VirtualMachineId) (result PerformMaintenanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/performMaintenance", 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 +} + +// PerformMaintenanceThenPoll performs PerformMaintenance then polls until it's completed +func (c VirtualMachinesClient) PerformMaintenanceThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.PerformMaintenance(ctx, id) + if err != nil { + return fmt.Errorf("performing PerformMaintenance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PerformMaintenance: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_poweroff.go b/resource-manager/compute/2024-11-01/virtualmachines/method_poweroff.go new file mode 100644 index 00000000000..f5c1b75d289 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_poweroff.go @@ -0,0 +1,99 @@ +package virtualmachines + +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 PowerOffOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type PowerOffOperationOptions struct { + SkipShutdown *bool +} + +func DefaultPowerOffOperationOptions() PowerOffOperationOptions { + return PowerOffOperationOptions{} +} + +func (o PowerOffOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o PowerOffOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o PowerOffOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SkipShutdown != nil { + out.Append("skipShutdown", fmt.Sprintf("%v", *o.SkipShutdown)) + } + return &out +} + +// PowerOff ... +func (c VirtualMachinesClient) PowerOff(ctx context.Context, id VirtualMachineId, options PowerOffOperationOptions) (result PowerOffOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/powerOff", 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 +} + +// PowerOffThenPoll performs PowerOff then polls until it's completed +func (c VirtualMachinesClient) PowerOffThenPoll(ctx context.Context, id VirtualMachineId, options PowerOffOperationOptions) error { + result, err := c.PowerOff(ctx, id, options) + if err != nil { + return fmt.Errorf("performing PowerOff: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PowerOff: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_reapply.go b/resource-manager/compute/2024-11-01/virtualmachines/method_reapply.go new file mode 100644 index 00000000000..1ffcd0d835d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_reapply.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 ReapplyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reapply ... +func (c VirtualMachinesClient) Reapply(ctx context.Context, id VirtualMachineId) (result ReapplyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reapply", 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 +} + +// ReapplyThenPoll performs Reapply then polls until it's completed +func (c VirtualMachinesClient) ReapplyThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Reapply(ctx, id) + if err != nil { + return fmt.Errorf("performing Reapply: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reapply: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_redeploy.go b/resource-manager/compute/2024-11-01/virtualmachines/method_redeploy.go new file mode 100644 index 00000000000..78ed180cc3a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_redeploy.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c VirtualMachinesClient) Redeploy(ctx context.Context, id VirtualMachineId) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachinesClient) RedeployThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_reimage.go b/resource-manager/compute/2024-11-01/virtualmachines/method_reimage.go new file mode 100644 index 00000000000..993467b3f1d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_reimage.go @@ -0,0 +1,74 @@ +package virtualmachines + +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 ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c VirtualMachinesClient) Reimage(ctx context.Context, id VirtualMachineId, input VirtualMachineReimageParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", 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 +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c VirtualMachinesClient) ReimageThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineReimageParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_restart.go b/resource-manager/compute/2024-11-01/virtualmachines/method_restart.go new file mode 100644 index 00000000000..72a964e8b70 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_restart.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachinesClient) Restart(ctx context.Context, id VirtualMachineId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachinesClient) RestartThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_retrievebootdiagnosticsdata.go b/resource-manager/compute/2024-11-01/virtualmachines/method_retrievebootdiagnosticsdata.go new file mode 100644 index 00000000000..cf8035af464 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_retrievebootdiagnosticsdata.go @@ -0,0 +1,83 @@ +package virtualmachines + +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 RetrieveBootDiagnosticsDataOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RetrieveBootDiagnosticsDataResult +} + +type RetrieveBootDiagnosticsDataOperationOptions struct { + SasUriExpirationTimeInMinutes *int64 +} + +func DefaultRetrieveBootDiagnosticsDataOperationOptions() RetrieveBootDiagnosticsDataOperationOptions { + return RetrieveBootDiagnosticsDataOperationOptions{} +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SasUriExpirationTimeInMinutes != nil { + out.Append("sasUriExpirationTimeInMinutes", fmt.Sprintf("%v", *o.SasUriExpirationTimeInMinutes)) + } + return &out +} + +// RetrieveBootDiagnosticsData ... +func (c VirtualMachinesClient) RetrieveBootDiagnosticsData(ctx context.Context, id VirtualMachineId, options RetrieveBootDiagnosticsDataOperationOptions) (result RetrieveBootDiagnosticsDataOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/retrieveBootDiagnosticsData", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RetrieveBootDiagnosticsDataResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_runcommand.go b/resource-manager/compute/2024-11-01/virtualmachines/method_runcommand.go new file mode 100644 index 00000000000..6724593464a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_runcommand.go @@ -0,0 +1,75 @@ +package virtualmachines + +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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c VirtualMachinesClient) RunCommand(ctx context.Context, id VirtualMachineId, input RunCommandInput) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c VirtualMachinesClient) RunCommandThenPoll(ctx context.Context, id VirtualMachineId, input RunCommandInput) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_simulateeviction.go b/resource-manager/compute/2024-11-01/virtualmachines/method_simulateeviction.go new file mode 100644 index 00000000000..8363eb86067 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_simulateeviction.go @@ -0,0 +1,47 @@ +package virtualmachines + +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 SimulateEvictionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// SimulateEviction ... +func (c VirtualMachinesClient) SimulateEviction(ctx context.Context, id VirtualMachineId) (result SimulateEvictionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/simulateEviction", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_start.go b/resource-manager/compute/2024-11-01/virtualmachines/method_start.go new file mode 100644 index 00000000000..09a076e9892 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_start.go @@ -0,0 +1,70 @@ +package virtualmachines + +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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachinesClient) Start(ctx context.Context, id VirtualMachineId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachinesClient) StartThenPoll(ctx context.Context, id VirtualMachineId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/method_update.go b/resource-manager/compute/2024-11-01/virtualmachines/method_update.go new file mode 100644 index 00000000000..96f8c0490ea --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/method_update.go @@ -0,0 +1,107 @@ +package virtualmachines + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachine +} + +type UpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VirtualMachinesClient) Update(ctx context.Context, id VirtualMachineId, input VirtualMachineUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + OptionsObject: options, + 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 VirtualMachinesClient) UpdateThenPoll(ctx context.Context, id VirtualMachineId, input VirtualMachineUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/compute/2024-11-01/virtualmachines/model_additionalcapabilities.go b/resource-manager/compute/2024-11-01/virtualmachines/model_additionalcapabilities.go new file mode 100644 index 00000000000..c1f4ea72269 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_additionalcapabilities.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_additionalunattendcontent.go b/resource-manager/compute/2024-11-01/virtualmachines/model_additionalunattendcontent.go new file mode 100644 index 00000000000..8cbd6bbbc9d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentNames `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassNames `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_apientityreference.go b/resource-manager/compute/2024-11-01/virtualmachines/model_apientityreference.go new file mode 100644 index 00000000000..8d25189f97d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_apientityreference.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_apierror.go b/resource-manager/compute/2024-11-01/virtualmachines/model_apierror.go new file mode 100644 index 00000000000..eb45b58287c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_apierror.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_apierrorbase.go b/resource-manager/compute/2024-11-01/virtualmachines/model_apierrorbase.go new file mode 100644 index 00000000000..d065d8c0829 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_apierrorbase.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_applicationprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_applicationprofile.go new file mode 100644 index 00000000000..f40a5d2be92 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_applicationprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProfile struct { + GalleryApplications *[]VMGalleryApplication `json:"galleryApplications,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_attachdetachdatadisksrequest.go b/resource-manager/compute/2024-11-01/virtualmachines/model_attachdetachdatadisksrequest.go new file mode 100644 index 00000000000..44e542e573a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_attachdetachdatadisksrequest.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachDetachDataDisksRequest struct { + DataDisksToAttach *[]DataDisksToAttach `json:"dataDisksToAttach,omitempty"` + DataDisksToDetach *[]DataDisksToDetach `json:"dataDisksToDetach,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_availablepatchsummary.go b/resource-manager/compute/2024-11-01/virtualmachines/model_availablepatchsummary.go new file mode 100644 index 00000000000..da7f29507df --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_availablepatchsummary.go @@ -0,0 +1,45 @@ +package virtualmachines + +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 AvailablePatchSummary struct { + AssessmentActivityId *string `json:"assessmentActivityId,omitempty"` + CriticalAndSecurityPatchCount *int64 `json:"criticalAndSecurityPatchCount,omitempty"` + Error *ApiError `json:"error,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + OtherPatchCount *int64 `json:"otherPatchCount,omitempty"` + RebootPending *bool `json:"rebootPending,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *AvailablePatchSummary) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AvailablePatchSummary) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} + +func (o *AvailablePatchSummary) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *AvailablePatchSummary) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_billingprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_billingprofile.go new file mode 100644 index 00000000000..430748093f8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_billingprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingProfile struct { + MaxPrice *float64 `json:"maxPrice,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnostics.go b/resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnostics.go new file mode 100644 index 00000000000..973026ef552 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnosticsinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnosticsinstanceview.go new file mode 100644 index 00000000000..22f9de0401e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_bootdiagnosticsinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnosticsInstanceView struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_capacityreservationprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_capacityreservationprofile.go new file mode 100644 index 00000000000..24f03ca3737 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_capacityreservationprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationProfile struct { + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_datadisk.go b/resource-manager/compute/2024-11-01/virtualmachines/model_datadisk.go new file mode 100644 index 00000000000..9862ec82440 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_datadisk.go @@ -0,0 +1,22 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + SourceResource *ApiEntityReference `json:"sourceResource,omitempty"` + ToBeDetached *bool `json:"toBeDetached,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstoattach.go b/resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstoattach.go new file mode 100644 index 00000000000..8673860f112 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstoattach.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToAttach struct { + Caching *CachingTypes `json:"caching,omitempty"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskId string `json:"diskId"` + Lun *int64 `json:"lun,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstodetach.go b/resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstodetach.go new file mode 100644 index 00000000000..0f69610548f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_datadiskstodetach.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToDetach struct { + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskId string `json:"diskId"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_diagnosticsprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_diagnosticsprofile.go new file mode 100644 index 00000000000..03ff4c6f82a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_diffdisksettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_diffdisksettings.go new file mode 100644 index 00000000000..cf3958588b8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_diskencryptionsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_diskencryptionsettings.go new file mode 100644 index 00000000000..f043b50178b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_diskinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/model_diskinstanceview.go new file mode 100644 index 00000000000..df99a282006 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_diskinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskInstanceView struct { + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_encryptionidentity.go b/resource-manager/compute/2024-11-01/virtualmachines/model_encryptionidentity.go new file mode 100644 index 00000000000..a301d4caf32 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package virtualmachines + +// 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 { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_eventgridandresourcegraph.go b/resource-manager/compute/2024-11-01/virtualmachines/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..2b13155f81f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_eventgridandresourcegraph.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_hardwareprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_hardwareprofile.go new file mode 100644 index 00000000000..202eb9b34f9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_hostendpointsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_hostendpointsettings.go new file mode 100644 index 00000000000..67bf389c2d2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_imagereference.go b/resource-manager/compute/2024-11-01/virtualmachines/model_imagereference.go new file mode 100644 index 00000000000..64a1fc045b5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_imagereference.go @@ -0,0 +1,15 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_innererror.go b/resource-manager/compute/2024-11-01/virtualmachines/model_innererror.go new file mode 100644 index 00000000000..1b0445d0ac8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_innererror.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachines/model_instanceviewstatus.go new file mode 100644 index 00000000000..9c5cb3e75d8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachines + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultkeyreference.go b/resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..c50244524ea --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..b739f603f31 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_lastpatchinstallationsummary.go b/resource-manager/compute/2024-11-01/virtualmachines/model_lastpatchinstallationsummary.go new file mode 100644 index 00000000000..987c11896cf --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_lastpatchinstallationsummary.go @@ -0,0 +1,48 @@ +package virtualmachines + +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 LastPatchInstallationSummary struct { + Error *ApiError `json:"error,omitempty"` + ExcludedPatchCount *int64 `json:"excludedPatchCount,omitempty"` + FailedPatchCount *int64 `json:"failedPatchCount,omitempty"` + InstallationActivityId *string `json:"installationActivityId,omitempty"` + InstalledPatchCount *int64 `json:"installedPatchCount,omitempty"` + LastModifiedTime *string `json:"lastModifiedTime,omitempty"` + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty"` + NotSelectedPatchCount *int64 `json:"notSelectedPatchCount,omitempty"` + PendingPatchCount *int64 `json:"pendingPatchCount,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *LastPatchInstallationSummary) GetLastModifiedTimeAsTime() (*time.Time, error) { + if o.LastModifiedTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LastPatchInstallationSummary) SetLastModifiedTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedTime = &formatted +} + +func (o *LastPatchInstallationSummary) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *LastPatchInstallationSummary) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_linuxconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxconfiguration.go new file mode 100644 index 00000000000..9cf230b3b45 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_linuxparameters.go b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxparameters.go new file mode 100644 index 00000000000..0a4cb464f03 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxparameters.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxParameters struct { + ClassificationsToInclude *[]VMGuestPatchClassificationLinux `json:"classificationsToInclude,omitempty"` + MaintenanceRunId *string `json:"maintenanceRunId,omitempty"` + PackageNameMasksToExclude *[]string `json:"packageNameMasksToExclude,omitempty"` + PackageNameMasksToInclude *[]string `json:"packageNameMasksToInclude,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_linuxpatchsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxpatchsettings.go new file mode 100644 index 00000000000..6cab7bb4d77 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..d01cfc95836 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_maintenanceredeploystatus.go b/resource-manager/compute/2024-11-01/virtualmachines/model_maintenanceredeploystatus.go new file mode 100644 index 00000000000..daebcaa340c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_maintenanceredeploystatus.go @@ -0,0 +1,68 @@ +package virtualmachines + +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 MaintenanceRedeployStatus struct { + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + LastOperationResultCode *MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + MaintenanceWindowEndTime *string `json:"maintenanceWindowEndTime,omitempty"` + MaintenanceWindowStartTime *string `json:"maintenanceWindowStartTime,omitempty"` + PreMaintenanceWindowEndTime *string `json:"preMaintenanceWindowEndTime,omitempty"` + PreMaintenanceWindowStartTime *string `json:"preMaintenanceWindowStartTime,omitempty"` +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowStartTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowStartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_manageddiskparameters.go b/resource-manager/compute/2024-11-01/virtualmachines/model_manageddiskparameters.go new file mode 100644 index 00000000000..e405c361b60 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go b/resource-manager/compute/2024-11-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go new file mode 100644 index 00000000000..3f9a0378f88 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_migratevmtovirtualmachinescalesetinput.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type MigrateVMToVirtualMachineScaleSetInput struct { + TargetFaultDomain *int64 `json:"targetFaultDomain,omitempty"` + TargetVMSize *string `json:"targetVMSize,omitempty"` + TargetZone *string `json:"targetZone,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereference.go b/resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereference.go new file mode 100644 index 00000000000..a2111db0c57 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereference.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReference struct { + Id *string `json:"id,omitempty"` + Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereferenceproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereferenceproperties.go new file mode 100644 index 00000000000..67a2785687f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_networkinterfacereferenceproperties.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReferenceProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_networkprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_networkprofile.go new file mode 100644 index 00000000000..0a5744ae56d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_networkprofile.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_osdisk.go b/resource-manager/compute/2024-11-01/virtualmachines/model_osdisk.go new file mode 100644 index 00000000000..dc4a229b622 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_osdisk.go @@ -0,0 +1,19 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_osimagenotificationprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_osimagenotificationprofile.go new file mode 100644 index 00000000000..ddbc2dd6c5a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_osimagenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSImageNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_osprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_osprofile.go new file mode 100644 index 00000000000..513bcc59472 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_osprofile.go @@ -0,0 +1,16 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_osprofileprovisioningdata.go b/resource-manager/compute/2024-11-01/virtualmachines/model_osprofileprovisioningdata.go new file mode 100644 index 00000000000..fa3bf13c1a7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_osprofileprovisioningdata.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileProvisioningData struct { + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_patchinstallationdetail.go b/resource-manager/compute/2024-11-01/virtualmachines/model_patchinstallationdetail.go new file mode 100644 index 00000000000..b17aa46e9f1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_patchinstallationdetail.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchInstallationDetail struct { + Classifications *[]string `json:"classifications,omitempty"` + InstallationState *PatchInstallationState `json:"installationState,omitempty"` + KbId *string `json:"kbId,omitempty"` + Name *string `json:"name,omitempty"` + PatchId *string `json:"patchId,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_patchsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_patchsettings.go new file mode 100644 index 00000000000..fa62f8db7d2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_patchsettings.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_placement.go b/resource-manager/compute/2024-11-01/virtualmachines/model_placement.go new file mode 100644 index 00000000000..92895903ef9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_placement.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Placement struct { + ExcludeZones *[]string `json:"excludeZones,omitempty"` + IncludeZones *[]string `json:"includeZones,omitempty"` + ZonePlacementPolicy *ZonePlacementPolicyType `json:"zonePlacementPolicy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_plan.go b/resource-manager/compute/2024-11-01/virtualmachines/model_plan.go new file mode 100644 index 00000000000..d99f0a00ba4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_plan.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_proxyagentsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_proxyagentsettings.go new file mode 100644 index 00000000000..aea294e4d80 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_proxyagentsettings.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_publicipaddresssku.go b/resource-manager/compute/2024-11-01/virtualmachines/model_publicipaddresssku.go new file mode 100644 index 00000000000..4783908fdd2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go b/resource-manager/compute/2024-11-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go new file mode 100644 index 00000000000..936c3eb1c64 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_retrievebootdiagnosticsdataresult.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveBootDiagnosticsDataResult struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinput.go b/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinput.go new file mode 100644 index 00000000000..de283a9604a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinput.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInput struct { + CommandId string `json:"commandId"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + Script *[]string `json:"script,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinputparameter.go b/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinputparameter.go new file mode 100644 index 00000000000..647469c97b3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandresult.go b/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandresult.go new file mode 100644 index 00000000000..deeeb12253f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_runcommandresult.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandResult struct { + Value *[]InstanceViewStatus `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..90d123f4dc2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventspolicy.go b/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..7f2aa3ca544 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventspolicy.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsprofile.go new file mode 100644 index 00000000000..c4d619e1f44 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_scheduledeventsprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsProfile struct { + OsImageNotificationProfile *OSImageNotificationProfile `json:"osImageNotificationProfile,omitempty"` + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_securityprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_securityprofile.go new file mode 100644 index 00000000000..21dff4e227a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_securityprofile.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_sshconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_sshconfiguration.go new file mode 100644 index 00000000000..415a68d1131 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_sshpublickey.go b/resource-manager/compute/2024-11-01/virtualmachines/model_sshpublickey.go new file mode 100644 index 00000000000..7b37d0ed998 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_sshpublickey.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_storageprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_storageprofile.go new file mode 100644 index 00000000000..359a18196c6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_storageprofile.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + AlignRegionalDisksToVMZone *bool `json:"alignRegionalDisksToVMZone,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_subresource.go b/resource-manager/compute/2024-11-01/virtualmachines/model_subresource.go new file mode 100644 index 00000000000..d63b96f27e3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_terminatenotificationprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_terminatenotificationprofile.go new file mode 100644 index 00000000000..ff62463069c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_terminatenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TerminateNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_uefisettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_uefisettings.go new file mode 100644 index 00000000000..dad471d9f35 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_uefisettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedreboot.go b/resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedreboot.go new file mode 100644 index 00000000000..61e5b12a9e6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedredeploy.go b/resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..9b68b1337fa --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_vaultcertificate.go b/resource-manager/compute/2024-11-01/virtualmachines/model_vaultcertificate.go new file mode 100644 index 00000000000..73f8924cdde --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_vaultsecretgroup.go b/resource-manager/compute/2024-11-01/virtualmachines/model_vaultsecretgroup.go new file mode 100644 index 00000000000..f7c88cb420c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualharddisk.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualharddisk.go new file mode 100644 index 00000000000..c8d3cd52669 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachine.go new file mode 100644 index 00000000000..7dd606a5955 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachine.go @@ -0,0 +1,27 @@ +package virtualmachines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 VirtualMachine struct { + Etag *string `json:"etag,omitempty"` + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + ManagedBy *string `json:"managedBy,omitempty"` + Name *string `json:"name,omitempty"` + Placement *Placement `json:"placement,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineProperties `json:"properties,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineagentinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineagentinstanceview.go new file mode 100644 index 00000000000..7dbc1430c8f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineagentinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineAgentInstanceView struct { + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineassesspatchesresult.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineassesspatchesresult.go new file mode 100644 index 00000000000..aac8e0a30db --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineassesspatchesresult.go @@ -0,0 +1,33 @@ +package virtualmachines + +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 VirtualMachineAssessPatchesResult struct { + AssessmentActivityId *string `json:"assessmentActivityId,omitempty"` + AvailablePatches *[]VirtualMachineSoftwarePatchProperties `json:"availablePatches,omitempty"` + CriticalAndSecurityPatchCount *int64 `json:"criticalAndSecurityPatchCount,omitempty"` + Error *ApiError `json:"error,omitempty"` + OtherPatchCount *int64 `json:"otherPatchCount,omitempty"` + RebootPending *bool `json:"rebootPending,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *VirtualMachineAssessPatchesResult) GetStartDateTimeAsTime() (*time.Time, error) { + if o.StartDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineAssessPatchesResult) SetStartDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartDateTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureparameters.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureparameters.go new file mode 100644 index 00000000000..078286c327c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureparameters.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineCaptureParameters struct { + DestinationContainerName string `json:"destinationContainerName"` + OverwriteVhds bool `json:"overwriteVhds"` + VhdPrefix string `json:"vhdPrefix"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureresult.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureresult.go new file mode 100644 index 00000000000..daaf5617a33 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinecaptureresult.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineCaptureResult struct { + ContentVersion *string `json:"contentVersion,omitempty"` + Id *string `json:"id,omitempty"` + Parameters *interface{} `json:"parameters,omitempty"` + Resources *[]interface{} `json:"resources,omitempty"` + Schema *string `json:"$schema,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextension.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextension.go new file mode 100644 index 00000000000..880b0f17a25 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextension.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go new file mode 100644 index 00000000000..6895f8092d0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionhandlerinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionHandlerInstanceView struct { + Status *InstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..1f474e8bed2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..58201efcab3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinehealthstatus.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinehealthstatus.go new file mode 100644 index 00000000000..021c0337a8b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinehealthstatus.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineHealthStatus struct { + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go new file mode 100644 index 00000000000..b1810258e64 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesparameters.go @@ -0,0 +1,11 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstallPatchesParameters struct { + LinuxParameters *LinuxParameters `json:"linuxParameters,omitempty"` + MaximumDuration *string `json:"maximumDuration,omitempty"` + RebootSetting VMGuestPatchRebootSetting `json:"rebootSetting"` + WindowsParameters *WindowsParameters `json:"windowsParameters,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesresult.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesresult.go new file mode 100644 index 00000000000..52e875ae035 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstallpatchesresult.go @@ -0,0 +1,37 @@ +package virtualmachines + +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 VirtualMachineInstallPatchesResult struct { + Error *ApiError `json:"error,omitempty"` + ExcludedPatchCount *int64 `json:"excludedPatchCount,omitempty"` + FailedPatchCount *int64 `json:"failedPatchCount,omitempty"` + InstallationActivityId *string `json:"installationActivityId,omitempty"` + InstalledPatchCount *int64 `json:"installedPatchCount,omitempty"` + MaintenanceWindowExceeded *bool `json:"maintenanceWindowExceeded,omitempty"` + NotSelectedPatchCount *int64 `json:"notSelectedPatchCount,omitempty"` + Patches *[]PatchInstallationDetail `json:"patches,omitempty"` + PendingPatchCount *int64 `json:"pendingPatchCount,omitempty"` + RebootStatus *VMGuestPatchRebootStatus `json:"rebootStatus,omitempty"` + StartDateTime *string `json:"startDateTime,omitempty"` + Status *PatchOperationStatus `json:"status,omitempty"` +} + +func (o *VirtualMachineInstallPatchesResult) GetStartDateTimeAsTime() (*time.Time, error) { + if o.StartDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineInstallPatchesResult) SetStartDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartDateTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstanceview.go new file mode 100644 index 00000000000..8115a5b3cff --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineinstanceview.go @@ -0,0 +1,24 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceView struct { + AssignedHost *string `json:"assignedHost,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + HyperVGeneration *HyperVGenerationType `json:"hyperVGeneration,omitempty"` + IsVMInStandbyPool *bool `json:"isVMInStandbyPool,omitempty"` + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PatchStatus *VirtualMachinePatchStatus `json:"patchStatus,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + PlatformUpdateDomain *int64 `json:"platformUpdateDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineiptag.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineiptag.go new file mode 100644 index 00000000000..9b7778110d2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineiptag.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go new file mode 100644 index 00000000000..2a50153e195 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go new file mode 100644 index 00000000000..4a93a335955 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceconfigurationproperties.go @@ -0,0 +1,19 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineNetworkInterfaceDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineNetworkInterfaceIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go new file mode 100644 index 00000000000..d0610637be3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfacednssettingsconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceDnsSettingsConfiguration struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go new file mode 100644 index 00000000000..d84aa7ee7c9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go new file mode 100644 index 00000000000..ac1a9f67ae9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinenetworkinterfaceipconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersions `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepatchstatus.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepatchstatus.go new file mode 100644 index 00000000000..563ee2e6237 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepatchstatus.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePatchStatus struct { + AvailablePatchSummary *AvailablePatchSummary `json:"availablePatchSummary,omitempty"` + ConfigurationStatuses *[]InstanceViewStatus `json:"configurationStatuses,omitempty"` + LastPatchInstallationSummary *LastPatchInstallationSummary `json:"lastPatchInstallationSummary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineproperties.go new file mode 100644 index 00000000000..2de07158c5e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineproperties.go @@ -0,0 +1,52 @@ +package virtualmachines + +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 VirtualMachineProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + Host *SubResource `json:"host,omitempty"` + HostGroup *SubResource `json:"hostGroup,omitempty"` + InstanceView *VirtualMachineInstanceView `json:"instanceView,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` + VirtualMachineScaleSet *SubResource `json:"virtualMachineScaleSet,omitempty"` +} + +func (o *VirtualMachineProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go new file mode 100644 index 00000000000..6caa9f72846 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachinePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..6352be21b5c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachinePublicIPAddressDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersions `json:"publicIPAddressVersion,omitempty"` + PublicIPAllocationMethod *PublicIPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go new file mode 100644 index 00000000000..8159711227a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinepublicipaddressdnssettingsconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressDnsSettingsConfiguration struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinereimageparameters.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinereimageparameters.go new file mode 100644 index 00000000000..8dcea267ddd --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinereimageparameters.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineReimageParameters struct { + ExactVersion *string `json:"exactVersion,omitempty"` + OsProfile *OSProfileProvisioningData `json:"osProfile,omitempty"` + TempDisk *bool `json:"tempDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesize.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesize.go new file mode 100644 index 00000000000..5de05c343a9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesizelistresult.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesizelistresult.go new file mode 100644 index 00000000000..f4680d16c8f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesizelistresult.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSizeListResult struct { + Value *[]VirtualMachineSize `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go new file mode 100644 index 00000000000..8d12f134ef1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachinesoftwarepatchproperties.go @@ -0,0 +1,47 @@ +package virtualmachines + +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 VirtualMachineSoftwarePatchProperties struct { + ActivityId *string `json:"activityId,omitempty"` + AssessmentState *PatchAssessmentState `json:"assessmentState,omitempty"` + Classifications *[]string `json:"classifications,omitempty"` + KbId *string `json:"kbId,omitempty"` + LastModifiedDateTime *string `json:"lastModifiedDateTime,omitempty"` + Name *string `json:"name,omitempty"` + PatchId *string `json:"patchId,omitempty"` + PublishedDate *string `json:"publishedDate,omitempty"` + RebootBehavior *VMGuestPatchRebootBehavior `json:"rebootBehavior,omitempty"` + Version *string `json:"version,omitempty"` +} + +func (o *VirtualMachineSoftwarePatchProperties) GetLastModifiedDateTimeAsTime() (*time.Time, error) { + if o.LastModifiedDateTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastModifiedDateTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineSoftwarePatchProperties) SetLastModifiedDateTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastModifiedDateTime = &formatted +} + +func (o *VirtualMachineSoftwarePatchProperties) GetPublishedDateAsTime() (*time.Time, error) { + if o.PublishedDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PublishedDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineSoftwarePatchProperties) SetPublishedDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PublishedDate = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineupdate.go b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineupdate.go new file mode 100644 index 00000000000..360d625ebac --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_virtualmachineupdate.go @@ -0,0 +1,17 @@ +package virtualmachines + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 VirtualMachineUpdate struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_vmdisksecurityprofile.go b/resource-manager/compute/2024-11-01/virtualmachines/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..ad81ec1c12c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_vmgalleryapplication.go b/resource-manager/compute/2024-11-01/virtualmachines/model_vmgalleryapplication.go new file mode 100644 index 00000000000..90b989063e5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_vmgalleryapplication.go @@ -0,0 +1,13 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMGalleryApplication struct { + ConfigurationReference *string `json:"configurationReference,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + Order *int64 `json:"order,omitempty"` + PackageReferenceId string `json:"packageReferenceId"` + Tags *string `json:"tags,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_vmsizeproperties.go b/resource-manager/compute/2024-11-01/virtualmachines/model_vmsizeproperties.go new file mode 100644 index 00000000000..f4e57fddd1b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_windowsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_windowsconfiguration.go new file mode 100644 index 00000000000..45060fd6cec --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_windowsparameters.go b/resource-manager/compute/2024-11-01/virtualmachines/model_windowsparameters.go new file mode 100644 index 00000000000..3e07917b60a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_windowsparameters.go @@ -0,0 +1,30 @@ +package virtualmachines + +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 WindowsParameters struct { + ClassificationsToInclude *[]VMGuestPatchClassificationWindows `json:"classificationsToInclude,omitempty"` + ExcludeKbsRequiringReboot *bool `json:"excludeKbsRequiringReboot,omitempty"` + KbNumbersToExclude *[]string `json:"kbNumbersToExclude,omitempty"` + KbNumbersToInclude *[]string `json:"kbNumbersToInclude,omitempty"` + MaxPatchPublishDate *string `json:"maxPatchPublishDate,omitempty"` +} + +func (o *WindowsParameters) GetMaxPatchPublishDateAsTime() (*time.Time, error) { + if o.MaxPatchPublishDate == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaxPatchPublishDate, "2006-01-02T15:04:05Z07:00") +} + +func (o *WindowsParameters) SetMaxPatchPublishDateAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaxPatchPublishDate = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..21886cadbc0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_winrmconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachines/model_winrmconfiguration.go new file mode 100644 index 00000000000..2afec23e6ff --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/model_winrmlistener.go b/resource-manager/compute/2024-11-01/virtualmachines/model_winrmlistener.go new file mode 100644 index 00000000000..30b38d846e4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/model_winrmlistener.go @@ -0,0 +1,9 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachines/predicates.go b/resource-manager/compute/2024-11-01/virtualmachines/predicates.go new file mode 100644 index 00000000000..565b9864a2e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/predicates.go @@ -0,0 +1,42 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineOperationPredicate struct { + Etag *string + Id *string + Location *string + ManagedBy *string + Name *string + Type *string +} + +func (p VirtualMachineOperationPredicate) Matches(input VirtualMachine) 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.ManagedBy != nil && (input.ManagedBy == nil || *p.ManagedBy != *input.ManagedBy) { + 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/compute/2024-11-01/virtualmachines/version.go b/resource-manager/compute/2024-11-01/virtualmachines/version.go new file mode 100644 index 00000000000..6e161fcf23a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachines/version.go @@ -0,0 +1,10 @@ +package virtualmachines + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachines/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/README.md b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/README.md new file mode 100644 index 00000000000..101c6eef0da --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions` Documentation + +The `virtualmachinescalesetextensions` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachinescalesetextensions" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +payload := virtualmachinescalesetextensions.VirtualMachineScaleSetExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +read, err := client.Get(ctx, id, virtualmachinescalesetextensions.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetExtensionsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// 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: `VirtualMachineScaleSetExtensionsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetextensions.NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + +payload := virtualmachinescalesetextensions.VirtualMachineScaleSetExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/client.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/client.go new file mode 100644 index 00000000000..8b2f0aa3f61 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetextensions + +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 VirtualMachineScaleSetExtensionsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetExtensionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetExtensionsClient: %+v", err) + } + + return &VirtualMachineScaleSetExtensionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..d9ab06b3c90 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesetextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..d361d893e30 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesetextensions + +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 = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId 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/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..371728a2982 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetExtensionId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetExtensionId{} + +// VirtualMachineScaleSetExtensionId is a struct representing the Resource ID for a Virtual Machine Scale Set Extension +type VirtualMachineScaleSetExtensionId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + ExtensionName string +} + +// NewVirtualMachineScaleSetExtensionID returns a new VirtualMachineScaleSetExtensionId struct +func NewVirtualMachineScaleSetExtensionID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, extensionName string) VirtualMachineScaleSetExtensionId { + return VirtualMachineScaleSetExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + ExtensionName: extensionName, + } +} + +// ParseVirtualMachineScaleSetExtensionID parses 'input' into a VirtualMachineScaleSetExtensionId +func ParseVirtualMachineScaleSetExtensionID(input string) (*VirtualMachineScaleSetExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetExtensionIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetExtensionId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetExtensionIDInsensitively(input string) (*VirtualMachineScaleSetExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetExtensionId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetExtensionID checks that 'input' can be parsed as a Virtual Machine Scale Set Extension ID +func ValidateVirtualMachineScaleSetExtensionID(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 := ParseVirtualMachineScaleSetExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Extension ID +func (id VirtualMachineScaleSetExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Extension ID +func (id VirtualMachineScaleSetExtensionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Extension ID +func (id VirtualMachineScaleSetExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Virtual Machine Scale Set Extension (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go new file mode 100644 index 00000000000..41e7a35c801 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/id_virtualmachinescalesetextension_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetextensions + +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 = &VirtualMachineScaleSetExtensionId{} + +func TestNewVirtualMachineScaleSetExtensionID(t *testing.T) { + id := NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.ExtensionName != "extensionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExtensionName'", id.ExtensionName, "extensionName") + } +} + +func TestFormatVirtualMachineScaleSetExtensionID(t *testing.T) { + actual := NewVirtualMachineScaleSetExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "extensionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetExtensionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetExtensionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName", + Expected: &VirtualMachineScaleSetExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetExtensionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestParseVirtualMachineScaleSetExtensionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetExtensionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/eXtEnSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName", + Expected: &VirtualMachineScaleSetExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extensions/extensionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/eXtEnSiOnS/eXtEnSiOnNaMe", + Expected: &VirtualMachineScaleSetExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + ExtensionName: "eXtEnSiOnNaMe", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/eXtEnSiOnS/eXtEnSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetExtensionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetExtensionId(t *testing.T) { + segments := VirtualMachineScaleSetExtensionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetExtensionId 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/compute/2024-11-01/virtualmachinescalesetextensions/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_createorupdate.go new file mode 100644 index 00000000000..a771df1fd11 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetExtension +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetExtensionsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtension) (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 VirtualMachineScaleSetExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtension) 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/compute/2024-11-01/virtualmachinescalesetextensions/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_delete.go new file mode 100644 index 00000000000..ce222a555c3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachinescalesetextensions + +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 VirtualMachineScaleSetExtensionsClient) Delete(ctx context.Context, id VirtualMachineScaleSetExtensionId) (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 VirtualMachineScaleSetExtensionsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetExtensionId) 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/compute/2024-11-01/virtualmachinescalesetextensions/method_get.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_get.go new file mode 100644 index 00000000000..58bd9a83728 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetextensions + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetExtension +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetExtensionsClient) Get(ctx context.Context, id VirtualMachineScaleSetExtensionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSetExtension + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_list.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_list.go new file mode 100644 index 00000000000..56536db416c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_list.go @@ -0,0 +1,105 @@ +package virtualmachinescalesetextensions + +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 *[]VirtualMachineScaleSetExtension +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSetExtension +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetExtensionsClient) List(ctx context.Context, id VirtualMachineScaleSetId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/extensions", 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 *[]VirtualMachineScaleSetExtension `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 VirtualMachineScaleSetExtensionsClient) ListComplete(ctx context.Context, id VirtualMachineScaleSetId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetExtensionOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetExtensionsClient) ListCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, predicate VirtualMachineScaleSetExtensionOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineScaleSetExtension, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_update.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_update.go new file mode 100644 index 00000000000..31f7662a5e0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/method_update.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetExtension +} + +// Update ... +func (c VirtualMachineScaleSetExtensionsClient) Update(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + 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 VirtualMachineScaleSetExtensionsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetExtensionId, input VirtualMachineScaleSetExtensionUpdate) 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/compute/2024-11-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..31af12dcf1e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_subresource.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_subresource.go new file mode 100644 index 00000000000..05f9cf02dc4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..f7c5e18f53c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextension.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtension struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go new file mode 100644 index 00000000000..6e65cbdd7d1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionproperties.go @@ -0,0 +1,19 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go new file mode 100644 index 00000000000..9e8382ae98c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/model_virtualmachinescalesetextensionupdate.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionUpdate struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/predicates.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/predicates.go new file mode 100644 index 00000000000..a03d9f7aa2b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/predicates.go @@ -0,0 +1,27 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetExtensionOperationPredicate) Matches(input VirtualMachineScaleSetExtension) 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/compute/2024-11-01/virtualmachinescalesetextensions/version.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/version.go new file mode 100644 index 00000000000..b71b810b886 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetextensions/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetextensions/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/README.md b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/README.md new file mode 100644 index 00000000000..2669f44fd00 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/README.md @@ -0,0 +1,72 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades` Documentation + +The `virtualmachinescalesetrollingupgrades` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachinescalesetrollingupgrades" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetrollingupgrades.NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetRollingUpgradesClient.Cancel` + +```go +ctx := context.TODO() +id := virtualmachinescalesetrollingupgrades.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.CancelThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetRollingUpgradesClient.GetLatest` + +```go +ctx := context.TODO() +id := virtualmachinescalesetrollingupgrades.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.GetLatest(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetRollingUpgradesClient.StartExtensionUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesetrollingupgrades.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.StartExtensionUpgradeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetRollingUpgradesClient.StartOSUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesetrollingupgrades.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.StartOSUpgradeThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/client.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/client.go new file mode 100644 index 00000000000..2bc32c3839f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetrollingupgrades + +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 VirtualMachineScaleSetRollingUpgradesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetRollingUpgradesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetRollingUpgradesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetrollingupgrades", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetRollingUpgradesClient: %+v", err) + } + + return &VirtualMachineScaleSetRollingUpgradesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/constants.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/constants.go new file mode 100644 index 00000000000..b0045b5b9e0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/constants.go @@ -0,0 +1,98 @@ +package virtualmachinescalesetrollingupgrades + +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 RollingUpgradeActionType string + +const ( + RollingUpgradeActionTypeCancel RollingUpgradeActionType = "Cancel" + RollingUpgradeActionTypeStart RollingUpgradeActionType = "Start" +) + +func PossibleValuesForRollingUpgradeActionType() []string { + return []string{ + string(RollingUpgradeActionTypeCancel), + string(RollingUpgradeActionTypeStart), + } +} + +func (s *RollingUpgradeActionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRollingUpgradeActionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRollingUpgradeActionType(input string) (*RollingUpgradeActionType, error) { + vals := map[string]RollingUpgradeActionType{ + "cancel": RollingUpgradeActionTypeCancel, + "start": RollingUpgradeActionTypeStart, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RollingUpgradeActionType(input) + return &out, nil +} + +type RollingUpgradeStatusCode string + +const ( + RollingUpgradeStatusCodeCancelled RollingUpgradeStatusCode = "Cancelled" + RollingUpgradeStatusCodeCompleted RollingUpgradeStatusCode = "Completed" + RollingUpgradeStatusCodeFaulted RollingUpgradeStatusCode = "Faulted" + RollingUpgradeStatusCodeRollingForward RollingUpgradeStatusCode = "RollingForward" +) + +func PossibleValuesForRollingUpgradeStatusCode() []string { + return []string{ + string(RollingUpgradeStatusCodeCancelled), + string(RollingUpgradeStatusCodeCompleted), + string(RollingUpgradeStatusCodeFaulted), + string(RollingUpgradeStatusCodeRollingForward), + } +} + +func (s *RollingUpgradeStatusCode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRollingUpgradeStatusCode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRollingUpgradeStatusCode(input string) (*RollingUpgradeStatusCode, error) { + vals := map[string]RollingUpgradeStatusCode{ + "cancelled": RollingUpgradeStatusCodeCancelled, + "completed": RollingUpgradeStatusCodeCompleted, + "faulted": RollingUpgradeStatusCodeFaulted, + "rollingforward": RollingUpgradeStatusCodeRollingForward, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RollingUpgradeStatusCode(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..1b3d32bde5b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesetrollingupgrades + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..2208e15ca77 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesetrollingupgrades + +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 = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId 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/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_cancel.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_cancel.go new file mode 100644 index 00000000000..6147fc5fedb --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_cancel.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetrollingupgrades + +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 CancelOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Cancel ... +func (c VirtualMachineScaleSetRollingUpgradesClient) Cancel(ctx context.Context, id VirtualMachineScaleSetId) (result CancelOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/rollingUpgrades/cancel", 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 +} + +// CancelThenPoll performs Cancel then polls until it's completed +func (c VirtualMachineScaleSetRollingUpgradesClient) CancelThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.Cancel(ctx, id) + if err != nil { + return fmt.Errorf("performing Cancel: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Cancel: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_getlatest.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_getlatest.go new file mode 100644 index 00000000000..647dbb00e17 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_getlatest.go @@ -0,0 +1,54 @@ +package virtualmachinescalesetrollingupgrades + +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 GetLatestOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RollingUpgradeStatusInfo +} + +// GetLatest ... +func (c VirtualMachineScaleSetRollingUpgradesClient) GetLatest(ctx context.Context, id VirtualMachineScaleSetId) (result GetLatestOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/rollingUpgrades/latest", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RollingUpgradeStatusInfo + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startextensionupgrade.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startextensionupgrade.go new file mode 100644 index 00000000000..5a5c446ad2a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startextensionupgrade.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetrollingupgrades + +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 StartExtensionUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// StartExtensionUpgrade ... +func (c VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgrade(ctx context.Context, id VirtualMachineScaleSetId) (result StartExtensionUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/extensionRollingUpgrade", 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 +} + +// StartExtensionUpgradeThenPoll performs StartExtensionUpgrade then polls until it's completed +func (c VirtualMachineScaleSetRollingUpgradesClient) StartExtensionUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.StartExtensionUpgrade(ctx, id) + if err != nil { + return fmt.Errorf("performing StartExtensionUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StartExtensionUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startosupgrade.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startosupgrade.go new file mode 100644 index 00000000000..06be09ed9c0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/method_startosupgrade.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetrollingupgrades + +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 StartOSUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// StartOSUpgrade ... +func (c VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgrade(ctx context.Context, id VirtualMachineScaleSetId) (result StartOSUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/osRollingUpgrade", 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 +} + +// StartOSUpgradeThenPoll performs StartOSUpgrade then polls until it's completed +func (c VirtualMachineScaleSetRollingUpgradesClient) StartOSUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.StartOSUpgrade(ctx, id) + if err != nil { + return fmt.Errorf("performing StartOSUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after StartOSUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierror.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierror.go new file mode 100644 index 00000000000..5e873d0ffa6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierror.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierrorbase.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierrorbase.go new file mode 100644 index 00000000000..5e3812f276b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_apierrorbase.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_innererror.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_innererror.go new file mode 100644 index 00000000000..7706cdd13a6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_innererror.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradepolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradepolicy.go new file mode 100644 index 00000000000..8d5d4ddeb53 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradepolicy.go @@ -0,0 +1,15 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradePolicy struct { + EnableCrossZoneUpgrade *bool `json:"enableCrossZoneUpgrade,omitempty"` + MaxBatchInstancePercent *int64 `json:"maxBatchInstancePercent,omitempty"` + MaxSurge *bool `json:"maxSurge,omitempty"` + MaxUnhealthyInstancePercent *int64 `json:"maxUnhealthyInstancePercent,omitempty"` + MaxUnhealthyUpgradedInstancePercent *int64 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + PrioritizeUnhealthyInstances *bool `json:"prioritizeUnhealthyInstances,omitempty"` + RollbackFailedInstancesOnPolicyBreach *bool `json:"rollbackFailedInstancesOnPolicyBreach,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradeprogressinfo.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradeprogressinfo.go new file mode 100644 index 00000000000..5bdb7fe6727 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradeprogressinfo.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeProgressInfo struct { + FailedInstanceCount *int64 `json:"failedInstanceCount,omitempty"` + InProgressInstanceCount *int64 `json:"inProgressInstanceCount,omitempty"` + PendingInstanceCount *int64 `json:"pendingInstanceCount,omitempty"` + SuccessfulInstanceCount *int64 `json:"successfulInstanceCount,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgraderunningstatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgraderunningstatus.go new file mode 100644 index 00000000000..7d5b9057f62 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgraderunningstatus.go @@ -0,0 +1,41 @@ +package virtualmachinescalesetrollingupgrades + +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 RollingUpgradeRunningStatus struct { + Code *RollingUpgradeStatusCode `json:"code,omitempty"` + LastAction *RollingUpgradeActionType `json:"lastAction,omitempty"` + LastActionTime *string `json:"lastActionTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` +} + +func (o *RollingUpgradeRunningStatus) GetLastActionTimeAsTime() (*time.Time, error) { + if o.LastActionTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.LastActionTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RollingUpgradeRunningStatus) SetLastActionTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.LastActionTime = &formatted +} + +func (o *RollingUpgradeRunningStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *RollingUpgradeRunningStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfo.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfo.go new file mode 100644 index 00000000000..6a13de25e9f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfo.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeStatusInfo struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *RollingUpgradeStatusInfoProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfoproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfoproperties.go new file mode 100644 index 00000000000..ba74f15648b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/model_rollingupgradestatusinfoproperties.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeStatusInfoProperties struct { + Error *ApiError `json:"error,omitempty"` + Policy *RollingUpgradePolicy `json:"policy,omitempty"` + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + RunningStatus *RollingUpgradeRunningStatus `json:"runningStatus,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/version.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/version.go new file mode 100644 index 00000000000..f0efc5098c6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetrollingupgrades/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetrollingupgrades + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetrollingupgrades/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/README.md b/resource-manager/compute/2024-11-01/virtualmachinescalesets/README.md new file mode 100644 index 00000000000..bddf131a863 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/README.md @@ -0,0 +1,437 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesets` Documentation + +The `virtualmachinescalesets` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesets" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesets.NewVirtualMachineScaleSetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ApproveRollingUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.ApproveRollingUpgradeThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ConvertToSinglePlacementGroup` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VMScaleSetConvertToSinglePlacementGroupInput{ + // ... +} + + +read, err := client.ConvertToSinglePlacementGroup(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSet{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultCreateOrUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Deallocate` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.DeallocateThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultDeallocateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.DeleteThenPoll(ctx, id, virtualmachinescalesets.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.DeleteInstances` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceRequiredIDs{ + // ... +} + + +if err := client.DeleteInstancesThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultDeleteInstancesOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ForceRecoveryServiceFabricPlatformUpdateDomainWalk` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx, id, virtualmachinescalesets.DefaultForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.Get(ctx, id, virtualmachinescalesets.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.GetInstanceView` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +read, err := client.GetInstanceView(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.GetOSUpgradeHistory` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.GetOSUpgradeHistory(ctx, id)` can be used to do batched pagination +items, err := client.GetOSUpgradeHistoryComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// 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: `VirtualMachineScaleSetsClient.ListAll` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// alternatively `client.ListAll(ctx, id)` can be used to do batched pagination +items, err := client.ListAllComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ListByLocation` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +// alternatively `client.ListByLocation(ctx, id)` can be used to do batched pagination +items, err := client.ListByLocationComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ListSkus` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.ListSkus(ctx, id)` can be used to do batched pagination +items, err := client.ListSkusComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.PerformMaintenance` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.PerformMaintenanceThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.PowerOff` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.PowerOffThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultPowerOffOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Reapply` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +if err := client.ReapplyThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.RedeployThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Reimage` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetReimageParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.ReimageAll` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.ReimageAllThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.RestartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.SetOrchestrationServiceState` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.OrchestrationServiceStateInput{ + // ... +} + + +if err := client.SetOrchestrationServiceStateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Start` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceIDs{ + // ... +} + + +if err := client.StartThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualmachinescalesets.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetsClient.UpdateInstances` + +```go +ctx := context.TODO() +id := virtualmachinescalesets.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +payload := virtualmachinescalesets.VirtualMachineScaleSetVMInstanceRequiredIDs{ + // ... +} + + +if err := client.UpdateInstancesThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/client.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/client.go new file mode 100644 index 00000000000..0548a7aec67 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetsClient: %+v", err) + } + + return &VirtualMachineScaleSetsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/constants.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/constants.go new file mode 100644 index 00000000000..36764cd4caa --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/constants.go @@ -0,0 +1,2015 @@ +package virtualmachinescalesets + +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 AllocationStrategy string + +const ( + AllocationStrategyCapacityOptimized AllocationStrategy = "CapacityOptimized" + AllocationStrategyLowestPrice AllocationStrategy = "LowestPrice" + AllocationStrategyPrioritized AllocationStrategy = "Prioritized" +) + +func PossibleValuesForAllocationStrategy() []string { + return []string{ + string(AllocationStrategyCapacityOptimized), + string(AllocationStrategyLowestPrice), + string(AllocationStrategyPrioritized), + } +} + +func (s *AllocationStrategy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationStrategy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationStrategy(input string) (*AllocationStrategy, error) { + vals := map[string]AllocationStrategy{ + "capacityoptimized": AllocationStrategyCapacityOptimized, + "lowestprice": AllocationStrategyLowestPrice, + "prioritized": AllocationStrategyPrioritized, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationStrategy(input) + return &out, nil +} + +type CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentNames string + +const ( + ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentNames() []string { + return []string{ + string(ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentNames(input string) (*ComponentNames, error) { + vals := map[string]ComponentNames{ + "microsoft-windows-shell-setup": ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentNames(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type ExpandTypesForGetVMScaleSets string + +const ( + ExpandTypesForGetVMScaleSetsUserData ExpandTypesForGetVMScaleSets = "userData" +) + +func PossibleValuesForExpandTypesForGetVMScaleSets() []string { + return []string{ + string(ExpandTypesForGetVMScaleSetsUserData), + } +} + +func (s *ExpandTypesForGetVMScaleSets) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExpandTypesForGetVMScaleSets(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExpandTypesForGetVMScaleSets(input string) (*ExpandTypesForGetVMScaleSets, error) { + vals := map[string]ExpandTypesForGetVMScaleSets{ + "userdata": ExpandTypesForGetVMScaleSetsUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExpandTypesForGetVMScaleSets(input) + return &out, nil +} + +type IPVersion string + +const ( + IPVersionIPvFour IPVersion = "IPv4" + IPVersionIPvSix IPVersion = "IPv6" +) + +func PossibleValuesForIPVersion() []string { + return []string{ + string(IPVersionIPvFour), + string(IPVersionIPvSix), + } +} + +func (s *IPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersion(input string) (*IPVersion, error) { + vals := map[string]IPVersion{ + "ipv4": IPVersionIPvFour, + "ipv6": IPVersionIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersion(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type OrchestrationMode string + +const ( + OrchestrationModeFlexible OrchestrationMode = "Flexible" + OrchestrationModeUniform OrchestrationMode = "Uniform" +) + +func PossibleValuesForOrchestrationMode() []string { + return []string{ + string(OrchestrationModeFlexible), + string(OrchestrationModeUniform), + } +} + +func (s *OrchestrationMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationMode(input string) (*OrchestrationMode, error) { + vals := map[string]OrchestrationMode{ + "flexible": OrchestrationModeFlexible, + "uniform": OrchestrationModeUniform, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationMode(input) + return &out, nil +} + +type OrchestrationServiceNames string + +const ( + OrchestrationServiceNamesAutomaticRepairs OrchestrationServiceNames = "AutomaticRepairs" +) + +func PossibleValuesForOrchestrationServiceNames() []string { + return []string{ + string(OrchestrationServiceNamesAutomaticRepairs), + } +} + +func (s *OrchestrationServiceNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceNames(input string) (*OrchestrationServiceNames, error) { + vals := map[string]OrchestrationServiceNames{ + "automaticrepairs": OrchestrationServiceNamesAutomaticRepairs, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceNames(input) + return &out, nil +} + +type OrchestrationServiceState string + +const ( + OrchestrationServiceStateNotRunning OrchestrationServiceState = "NotRunning" + OrchestrationServiceStateRunning OrchestrationServiceState = "Running" + OrchestrationServiceStateSuspended OrchestrationServiceState = "Suspended" +) + +func PossibleValuesForOrchestrationServiceState() []string { + return []string{ + string(OrchestrationServiceStateNotRunning), + string(OrchestrationServiceStateRunning), + string(OrchestrationServiceStateSuspended), + } +} + +func (s *OrchestrationServiceState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceState(input string) (*OrchestrationServiceState, error) { + vals := map[string]OrchestrationServiceState{ + "notrunning": OrchestrationServiceStateNotRunning, + "running": OrchestrationServiceStateRunning, + "suspended": OrchestrationServiceStateSuspended, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceState(input) + return &out, nil +} + +type OrchestrationServiceStateAction string + +const ( + OrchestrationServiceStateActionResume OrchestrationServiceStateAction = "Resume" + OrchestrationServiceStateActionSuspend OrchestrationServiceStateAction = "Suspend" +) + +func PossibleValuesForOrchestrationServiceStateAction() []string { + return []string{ + string(OrchestrationServiceStateActionResume), + string(OrchestrationServiceStateActionSuspend), + } +} + +func (s *OrchestrationServiceStateAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOrchestrationServiceStateAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOrchestrationServiceStateAction(input string) (*OrchestrationServiceStateAction, error) { + vals := map[string]OrchestrationServiceStateAction{ + "resume": OrchestrationServiceStateActionResume, + "suspend": OrchestrationServiceStateActionSuspend, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OrchestrationServiceStateAction(input) + return &out, nil +} + +type PassNames string + +const ( + PassNamesOobeSystem PassNames = "OobeSystem" +) + +func PossibleValuesForPassNames() []string { + return []string{ + string(PassNamesOobeSystem), + } +} + +func (s *PassNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassNames(input string) (*PassNames, error) { + vals := map[string]PassNames{ + "oobesystem": PassNamesOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassNames(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type RebalanceBehavior string + +const ( + RebalanceBehaviorCreateBeforeDelete RebalanceBehavior = "CreateBeforeDelete" +) + +func PossibleValuesForRebalanceBehavior() []string { + return []string{ + string(RebalanceBehaviorCreateBeforeDelete), + } +} + +func (s *RebalanceBehavior) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebalanceBehavior(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRebalanceBehavior(input string) (*RebalanceBehavior, error) { + vals := map[string]RebalanceBehavior{ + "createbeforedelete": RebalanceBehaviorCreateBeforeDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebalanceBehavior(input) + return &out, nil +} + +type RebalanceStrategy string + +const ( + RebalanceStrategyRecreate RebalanceStrategy = "Recreate" +) + +func PossibleValuesForRebalanceStrategy() []string { + return []string{ + string(RebalanceStrategyRecreate), + } +} + +func (s *RebalanceStrategy) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRebalanceStrategy(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRebalanceStrategy(input string) (*RebalanceStrategy, error) { + vals := map[string]RebalanceStrategy{ + "recreate": RebalanceStrategyRecreate, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RebalanceStrategy(input) + return &out, nil +} + +type RepairAction string + +const ( + RepairActionReimage RepairAction = "Reimage" + RepairActionReplace RepairAction = "Replace" + RepairActionRestart RepairAction = "Restart" +) + +func PossibleValuesForRepairAction() []string { + return []string{ + string(RepairActionReimage), + string(RepairActionReplace), + string(RepairActionRestart), + } +} + +func (s *RepairAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseRepairAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseRepairAction(input string) (*RepairAction, error) { + vals := map[string]RepairAction{ + "reimage": RepairActionReimage, + "replace": RepairActionReplace, + "restart": RepairActionRestart, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := RepairAction(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type UpgradeMode string + +const ( + UpgradeModeAutomatic UpgradeMode = "Automatic" + UpgradeModeManual UpgradeMode = "Manual" + UpgradeModeRolling UpgradeMode = "Rolling" +) + +func PossibleValuesForUpgradeMode() []string { + return []string{ + string(UpgradeModeAutomatic), + string(UpgradeModeManual), + string(UpgradeModeRolling), + } +} + +func (s *UpgradeMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeMode(input string) (*UpgradeMode, error) { + vals := map[string]UpgradeMode{ + "automatic": UpgradeModeAutomatic, + "manual": UpgradeModeManual, + "rolling": UpgradeModeRolling, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeMode(input) + return &out, nil +} + +type UpgradeOperationInvoker string + +const ( + UpgradeOperationInvokerPlatform UpgradeOperationInvoker = "Platform" + UpgradeOperationInvokerUnknown UpgradeOperationInvoker = "Unknown" + UpgradeOperationInvokerUser UpgradeOperationInvoker = "User" +) + +func PossibleValuesForUpgradeOperationInvoker() []string { + return []string{ + string(UpgradeOperationInvokerPlatform), + string(UpgradeOperationInvokerUnknown), + string(UpgradeOperationInvokerUser), + } +} + +func (s *UpgradeOperationInvoker) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeOperationInvoker(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeOperationInvoker(input string) (*UpgradeOperationInvoker, error) { + vals := map[string]UpgradeOperationInvoker{ + "platform": UpgradeOperationInvokerPlatform, + "unknown": UpgradeOperationInvokerUnknown, + "user": UpgradeOperationInvokerUser, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeOperationInvoker(input) + return &out, nil +} + +type UpgradeState string + +const ( + UpgradeStateCancelled UpgradeState = "Cancelled" + UpgradeStateCompleted UpgradeState = "Completed" + UpgradeStateFaulted UpgradeState = "Faulted" + UpgradeStateRollingForward UpgradeState = "RollingForward" +) + +func PossibleValuesForUpgradeState() []string { + return []string{ + string(UpgradeStateCancelled), + string(UpgradeStateCompleted), + string(UpgradeStateFaulted), + string(UpgradeStateRollingForward), + } +} + +func (s *UpgradeState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseUpgradeState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseUpgradeState(input string) (*UpgradeState, error) { + vals := map[string]UpgradeState{ + "cancelled": UpgradeStateCancelled, + "completed": UpgradeStateCompleted, + "faulted": UpgradeStateFaulted, + "rollingforward": UpgradeStateRollingForward, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := UpgradeState(input) + return &out, nil +} + +type VirtualMachineEvictionPolicyTypes string + +const ( + VirtualMachineEvictionPolicyTypesDeallocate VirtualMachineEvictionPolicyTypes = "Deallocate" + VirtualMachineEvictionPolicyTypesDelete VirtualMachineEvictionPolicyTypes = "Delete" +) + +func PossibleValuesForVirtualMachineEvictionPolicyTypes() []string { + return []string{ + string(VirtualMachineEvictionPolicyTypesDeallocate), + string(VirtualMachineEvictionPolicyTypesDelete), + } +} + +func (s *VirtualMachineEvictionPolicyTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineEvictionPolicyTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineEvictionPolicyTypes(input string) (*VirtualMachineEvictionPolicyTypes, error) { + vals := map[string]VirtualMachineEvictionPolicyTypes{ + "deallocate": VirtualMachineEvictionPolicyTypesDeallocate, + "delete": VirtualMachineEvictionPolicyTypesDelete, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineEvictionPolicyTypes(input) + return &out, nil +} + +type VirtualMachinePriorityTypes string + +const ( + VirtualMachinePriorityTypesLow VirtualMachinePriorityTypes = "Low" + VirtualMachinePriorityTypesRegular VirtualMachinePriorityTypes = "Regular" + VirtualMachinePriorityTypesSpot VirtualMachinePriorityTypes = "Spot" +) + +func PossibleValuesForVirtualMachinePriorityTypes() []string { + return []string{ + string(VirtualMachinePriorityTypesLow), + string(VirtualMachinePriorityTypesRegular), + string(VirtualMachinePriorityTypesSpot), + } +} + +func (s *VirtualMachinePriorityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachinePriorityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachinePriorityTypes(input string) (*VirtualMachinePriorityTypes, error) { + vals := map[string]VirtualMachinePriorityTypes{ + "low": VirtualMachinePriorityTypesLow, + "regular": VirtualMachinePriorityTypesRegular, + "spot": VirtualMachinePriorityTypesSpot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachinePriorityTypes(input) + return &out, nil +} + +type VirtualMachineScaleSetScaleInRules string + +const ( + VirtualMachineScaleSetScaleInRulesDefault VirtualMachineScaleSetScaleInRules = "Default" + VirtualMachineScaleSetScaleInRulesNewestVM VirtualMachineScaleSetScaleInRules = "NewestVM" + VirtualMachineScaleSetScaleInRulesOldestVM VirtualMachineScaleSetScaleInRules = "OldestVM" +) + +func PossibleValuesForVirtualMachineScaleSetScaleInRules() []string { + return []string{ + string(VirtualMachineScaleSetScaleInRulesDefault), + string(VirtualMachineScaleSetScaleInRulesNewestVM), + string(VirtualMachineScaleSetScaleInRulesOldestVM), + } +} + +func (s *VirtualMachineScaleSetScaleInRules) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineScaleSetScaleInRules(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineScaleSetScaleInRules(input string) (*VirtualMachineScaleSetScaleInRules, error) { + vals := map[string]VirtualMachineScaleSetScaleInRules{ + "default": VirtualMachineScaleSetScaleInRulesDefault, + "newestvm": VirtualMachineScaleSetScaleInRulesNewestVM, + "oldestvm": VirtualMachineScaleSetScaleInRulesOldestVM, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineScaleSetScaleInRules(input) + return &out, nil +} + +type VirtualMachineScaleSetSkuScaleType string + +const ( + VirtualMachineScaleSetSkuScaleTypeAutomatic VirtualMachineScaleSetSkuScaleType = "Automatic" + VirtualMachineScaleSetSkuScaleTypeNone VirtualMachineScaleSetSkuScaleType = "None" +) + +func PossibleValuesForVirtualMachineScaleSetSkuScaleType() []string { + return []string{ + string(VirtualMachineScaleSetSkuScaleTypeAutomatic), + string(VirtualMachineScaleSetSkuScaleTypeNone), + } +} + +func (s *VirtualMachineScaleSetSkuScaleType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineScaleSetSkuScaleType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineScaleSetSkuScaleType(input string) (*VirtualMachineScaleSetSkuScaleType, error) { + vals := map[string]VirtualMachineScaleSetSkuScaleType{ + "automatic": VirtualMachineScaleSetSkuScaleTypeAutomatic, + "none": VirtualMachineScaleSetSkuScaleTypeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineScaleSetSkuScaleType(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} + +type ZonalPlatformFaultDomainAlignMode string + +const ( + ZonalPlatformFaultDomainAlignModeAligned ZonalPlatformFaultDomainAlignMode = "Aligned" + ZonalPlatformFaultDomainAlignModeUnaligned ZonalPlatformFaultDomainAlignMode = "Unaligned" +) + +func PossibleValuesForZonalPlatformFaultDomainAlignMode() []string { + return []string{ + string(ZonalPlatformFaultDomainAlignModeAligned), + string(ZonalPlatformFaultDomainAlignModeUnaligned), + } +} + +func (s *ZonalPlatformFaultDomainAlignMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseZonalPlatformFaultDomainAlignMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseZonalPlatformFaultDomainAlignMode(input string) (*ZonalPlatformFaultDomainAlignMode, error) { + vals := map[string]ZonalPlatformFaultDomainAlignMode{ + "aligned": ZonalPlatformFaultDomainAlignModeAligned, + "unaligned": ZonalPlatformFaultDomainAlignModeUnaligned, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ZonalPlatformFaultDomainAlignMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location.go new file mode 100644 index 00000000000..1e550001f84 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location.go @@ -0,0 +1,121 @@ +package virtualmachinescalesets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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.Compute/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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/compute/2024-11-01/virtualmachinescalesets/id_location_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location_test.go new file mode 100644 index 00000000000..f01c16a7142 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_location_test.go @@ -0,0 +1,237 @@ +package virtualmachinescalesets + +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", "locationName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/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/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..fe53f8c0e32 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..c3cbe18c5f3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesets + +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 = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId 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/compute/2024-11-01/virtualmachinescalesets/method_approverollingupgrade.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_approverollingupgrade.go new file mode 100644 index 00000000000..3964624681f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_approverollingupgrade.go @@ -0,0 +1,73 @@ +package virtualmachinescalesets + +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 ApproveRollingUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApproveRollingUpgrade ... +func (c VirtualMachineScaleSetsClient) ApproveRollingUpgrade(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result ApproveRollingUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/approveRollingUpgrade", 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 +} + +// ApproveRollingUpgradeThenPoll performs ApproveRollingUpgrade then polls until it's completed +func (c VirtualMachineScaleSetsClient) ApproveRollingUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.ApproveRollingUpgrade(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ApproveRollingUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApproveRollingUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_converttosingleplacementgroup.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_converttosingleplacementgroup.go new file mode 100644 index 00000000000..e219b9b56a1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_converttosingleplacementgroup.go @@ -0,0 +1,51 @@ +package virtualmachinescalesets + +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 ConvertToSinglePlacementGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// ConvertToSinglePlacementGroup ... +func (c VirtualMachineScaleSetsClient) ConvertToSinglePlacementGroup(ctx context.Context, id VirtualMachineScaleSetId, input VMScaleSetConvertToSinglePlacementGroupInput) (result ConvertToSinglePlacementGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/convertToSinglePlacementGroup", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_createorupdate.go new file mode 100644 index 00000000000..ce61579304c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_createorupdate.go @@ -0,0 +1,108 @@ +package virtualmachinescalesets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSet +} + +type CreateOrUpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultCreateOrUpdateOperationOptions() CreateOrUpdateOperationOptions { + return CreateOrUpdateOperationOptions{} +} + +func (o CreateOrUpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o CreateOrUpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o CreateOrUpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSet, options CreateOrUpdateOperationOptions) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 VirtualMachineScaleSetsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSet, options CreateOrUpdateOperationOptions) error { + result, err := c.CreateOrUpdate(ctx, id, input, options) + 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/compute/2024-11-01/virtualmachinescalesets/method_deallocate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_deallocate.go new file mode 100644 index 00000000000..1965e606c51 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_deallocate.go @@ -0,0 +1,103 @@ +package virtualmachinescalesets + +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 DeallocateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeallocateOperationOptions struct { + Hibernate *bool +} + +func DefaultDeallocateOperationOptions() DeallocateOperationOptions { + return DeallocateOperationOptions{} +} + +func (o DeallocateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeallocateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeallocateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Hibernate != nil { + out.Append("hibernate", fmt.Sprintf("%v", *o.Hibernate)) + } + return &out +} + +// Deallocate ... +func (c VirtualMachineScaleSetsClient) Deallocate(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options DeallocateOperationOptions) (result DeallocateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/deallocate", 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 +} + +// DeallocateThenPoll performs Deallocate then polls until it's completed +func (c VirtualMachineScaleSetsClient) DeallocateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options DeallocateOperationOptions) error { + result, err := c.Deallocate(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing Deallocate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deallocate: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_delete.go new file mode 100644 index 00000000000..40c53c88532 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_delete.go @@ -0,0 +1,100 @@ +package virtualmachinescalesets + +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 { + ForceDeletion *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.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c VirtualMachineScaleSetsClient) Delete(ctx context.Context, id VirtualMachineScaleSetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 VirtualMachineScaleSetsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetId, 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/compute/2024-11-01/virtualmachinescalesets/method_deleteinstances.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_deleteinstances.go new file mode 100644 index 00000000000..ae1057f79fa --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_deleteinstances.go @@ -0,0 +1,103 @@ +package virtualmachinescalesets + +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 DeleteInstancesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type DeleteInstancesOperationOptions struct { + ForceDeletion *bool +} + +func DefaultDeleteInstancesOperationOptions() DeleteInstancesOperationOptions { + return DeleteInstancesOperationOptions{} +} + +func (o DeleteInstancesOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o DeleteInstancesOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o DeleteInstancesOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// DeleteInstances ... +func (c VirtualMachineScaleSetsClient) DeleteInstances(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs, options DeleteInstancesOperationOptions) (result DeleteInstancesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/delete", 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 +} + +// DeleteInstancesThenPoll performs DeleteInstances then polls until it's completed +func (c VirtualMachineScaleSetsClient) DeleteInstancesThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs, options DeleteInstancesOperationOptions) error { + result, err := c.DeleteInstances(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing DeleteInstances: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteInstances: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go new file mode 100644 index 00000000000..a49b926c058 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_forcerecoveryservicefabricplatformupdatedomainwalk.go @@ -0,0 +1,91 @@ +package virtualmachinescalesets + +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 ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RecoveryWalkResponse +} + +type ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions struct { + PlacementGroupId *string + PlatformUpdateDomain *int64 + Zone *string +} + +func DefaultForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions() ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions { + return ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions{} +} + +func (o ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.PlacementGroupId != nil { + out.Append("placementGroupId", fmt.Sprintf("%v", *o.PlacementGroupId)) + } + if o.PlatformUpdateDomain != nil { + out.Append("platformUpdateDomain", fmt.Sprintf("%v", *o.PlatformUpdateDomain)) + } + if o.Zone != nil { + out.Append("zone", fmt.Sprintf("%v", *o.Zone)) + } + return &out +} + +// ForceRecoveryServiceFabricPlatformUpdateDomainWalk ... +func (c VirtualMachineScaleSetsClient) ForceRecoveryServiceFabricPlatformUpdateDomainWalk(ctx context.Context, id VirtualMachineScaleSetId, options ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationOptions) (result ForceRecoveryServiceFabricPlatformUpdateDomainWalkOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/forceRecoveryServiceFabricPlatformUpdateDomainWalk", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RecoveryWalkResponse + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_get.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_get.go new file mode 100644 index 00000000000..4ade8c757e1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesets + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSet +} + +type GetOperationOptions struct { + Expand *ExpandTypesForGetVMScaleSets +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetsClient) Get(ctx context.Context, id VirtualMachineScaleSetId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSet + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getinstanceview.go new file mode 100644 index 00000000000..4e409bb9b3b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getinstanceview.go @@ -0,0 +1,54 @@ +package virtualmachinescalesets + +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 GetInstanceViewOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetInstanceView +} + +// GetInstanceView ... +func (c VirtualMachineScaleSetsClient) GetInstanceView(ctx context.Context, id VirtualMachineScaleSetId) (result GetInstanceViewOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/instanceView", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSetInstanceView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getosupgradehistory.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getosupgradehistory.go new file mode 100644 index 00000000000..1702f705887 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_getosupgradehistory.go @@ -0,0 +1,105 @@ +package virtualmachinescalesets + +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 GetOSUpgradeHistoryOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]UpgradeOperationHistoricalStatusInfo +} + +type GetOSUpgradeHistoryCompleteResult struct { + LatestHttpResponse *http.Response + Items []UpgradeOperationHistoricalStatusInfo +} + +type GetOSUpgradeHistoryCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *GetOSUpgradeHistoryCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// GetOSUpgradeHistory ... +func (c VirtualMachineScaleSetsClient) GetOSUpgradeHistory(ctx context.Context, id VirtualMachineScaleSetId) (result GetOSUpgradeHistoryOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &GetOSUpgradeHistoryCustomPager{}, + Path: fmt.Sprintf("%s/osUpgradeHistory", 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 *[]UpgradeOperationHistoricalStatusInfo `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// GetOSUpgradeHistoryComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) GetOSUpgradeHistoryComplete(ctx context.Context, id VirtualMachineScaleSetId) (GetOSUpgradeHistoryCompleteResult, error) { + return c.GetOSUpgradeHistoryCompleteMatchingPredicate(ctx, id, UpgradeOperationHistoricalStatusInfoOperationPredicate{}) +} + +// GetOSUpgradeHistoryCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) GetOSUpgradeHistoryCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, predicate UpgradeOperationHistoricalStatusInfoOperationPredicate) (result GetOSUpgradeHistoryCompleteResult, err error) { + items := make([]UpgradeOperationHistoricalStatusInfo, 0) + + resp, err := c.GetOSUpgradeHistory(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = GetOSUpgradeHistoryCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_list.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_list.go new file mode 100644 index 00000000000..1eaed1d1e4c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_list.go @@ -0,0 +1,106 @@ +package virtualmachinescalesets + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSet +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSet +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetsClient) List(ctx context.Context, id commonids.ResourceGroupId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `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 VirtualMachineScaleSetsClient) ListComplete(ctx context.Context, id commonids.ResourceGroupId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualMachineScaleSetOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineScaleSet, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listall.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listall.go new file mode 100644 index 00000000000..4dc2af1c444 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listall.go @@ -0,0 +1,106 @@ +package virtualmachinescalesets + +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 ListAllOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSet +} + +type ListAllCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSet +} + +type ListAllCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListAllCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListAll ... +func (c VirtualMachineScaleSetsClient) ListAll(ctx context.Context, id commonids.SubscriptionId) (result ListAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListAllCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.Compute/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListAllComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) ListAllComplete(ctx context.Context, id commonids.SubscriptionId) (ListAllCompleteResult, error) { + return c.ListAllCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{}) +} + +// ListAllCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListAllCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualMachineScaleSetOperationPredicate) (result ListAllCompleteResult, err error) { + items := make([]VirtualMachineScaleSet, 0) + + resp, err := c.ListAll(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListAllCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listbylocation.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listbylocation.go new file mode 100644 index 00000000000..2a0ba069763 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listbylocation.go @@ -0,0 +1,105 @@ +package virtualmachinescalesets + +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 ListByLocationOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSet +} + +type ListByLocationCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSet +} + +type ListByLocationCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByLocationCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByLocation ... +func (c VirtualMachineScaleSetsClient) ListByLocation(ctx context.Context, id LocationId) (result ListByLocationOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByLocationCustomPager{}, + Path: fmt.Sprintf("%s/virtualMachineScaleSets", 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 *[]VirtualMachineScaleSet `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByLocationComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) ListByLocationComplete(ctx context.Context, id LocationId) (ListByLocationCompleteResult, error) { + return c.ListByLocationCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetOperationPredicate{}) +} + +// ListByLocationCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListByLocationCompleteMatchingPredicate(ctx context.Context, id LocationId, predicate VirtualMachineScaleSetOperationPredicate) (result ListByLocationCompleteResult, err error) { + items := make([]VirtualMachineScaleSet, 0) + + resp, err := c.ListByLocation(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByLocationCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listskus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listskus.go new file mode 100644 index 00000000000..fbedf5765e1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_listskus.go @@ -0,0 +1,105 @@ +package virtualmachinescalesets + +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 ListSkusOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VirtualMachineScaleSetSku +} + +type ListSkusCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSetSku +} + +type ListSkusCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListSkusCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListSkus ... +func (c VirtualMachineScaleSetsClient) ListSkus(ctx context.Context, id VirtualMachineScaleSetId) (result ListSkusOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListSkusCustomPager{}, + Path: fmt.Sprintf("%s/skus", 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 *[]VirtualMachineScaleSetSku `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListSkusComplete retrieves all the results into a single object +func (c VirtualMachineScaleSetsClient) ListSkusComplete(ctx context.Context, id VirtualMachineScaleSetId) (ListSkusCompleteResult, error) { + return c.ListSkusCompleteMatchingPredicate(ctx, id, VirtualMachineScaleSetSkuOperationPredicate{}) +} + +// ListSkusCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetsClient) ListSkusCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, predicate VirtualMachineScaleSetSkuOperationPredicate) (result ListSkusCompleteResult, err error) { + items := make([]VirtualMachineScaleSetSku, 0) + + resp, err := c.ListSkus(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListSkusCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_performmaintenance.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_performmaintenance.go new file mode 100644 index 00000000000..63ec3aa83c8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_performmaintenance.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 PerformMaintenanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PerformMaintenance ... +func (c VirtualMachineScaleSetsClient) PerformMaintenance(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result PerformMaintenanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/performMaintenance", 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 +} + +// PerformMaintenanceThenPoll performs PerformMaintenance then polls until it's completed +func (c VirtualMachineScaleSetsClient) PerformMaintenanceThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.PerformMaintenance(ctx, id, input) + if err != nil { + return fmt.Errorf("performing PerformMaintenance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PerformMaintenance: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_poweroff.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_poweroff.go new file mode 100644 index 00000000000..0b805fc3b55 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_poweroff.go @@ -0,0 +1,103 @@ +package virtualmachinescalesets + +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 PowerOffOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type PowerOffOperationOptions struct { + SkipShutdown *bool +} + +func DefaultPowerOffOperationOptions() PowerOffOperationOptions { + return PowerOffOperationOptions{} +} + +func (o PowerOffOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o PowerOffOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o PowerOffOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SkipShutdown != nil { + out.Append("skipShutdown", fmt.Sprintf("%v", *o.SkipShutdown)) + } + return &out +} + +// PowerOff ... +func (c VirtualMachineScaleSetsClient) PowerOff(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options PowerOffOperationOptions) (result PowerOffOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/poweroff", 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 +} + +// PowerOffThenPoll performs PowerOff then polls until it's completed +func (c VirtualMachineScaleSetsClient) PowerOffThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs, options PowerOffOperationOptions) error { + result, err := c.PowerOff(ctx, id, input, options) + if err != nil { + return fmt.Errorf("performing PowerOff: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PowerOff: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reapply.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reapply.go new file mode 100644 index 00000000000..a3ac6524d5a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reapply.go @@ -0,0 +1,70 @@ +package virtualmachinescalesets + +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 ReapplyOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reapply ... +func (c VirtualMachineScaleSetsClient) Reapply(ctx context.Context, id VirtualMachineScaleSetId) (result ReapplyOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reapply", 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 +} + +// ReapplyThenPoll performs Reapply then polls until it's completed +func (c VirtualMachineScaleSetsClient) ReapplyThenPoll(ctx context.Context, id VirtualMachineScaleSetId) error { + result, err := c.Reapply(ctx, id) + if err != nil { + return fmt.Errorf("performing Reapply: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reapply: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_redeploy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_redeploy.go new file mode 100644 index 00000000000..14be3e0cbdf --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_redeploy.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c VirtualMachineScaleSetsClient) Redeploy(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachineScaleSetsClient) RedeployThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.Redeploy(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimage.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimage.go new file mode 100644 index 00000000000..7ef500c4503 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimage.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c VirtualMachineScaleSetsClient) Reimage(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetReimageParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", 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 +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c VirtualMachineScaleSetsClient) ReimageThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetReimageParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimageall.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimageall.go new file mode 100644 index 00000000000..40f9f362dc5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_reimageall.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 ReimageAllOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ReimageAll ... +func (c VirtualMachineScaleSetsClient) ReimageAll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result ReimageAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimageall", 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 +} + +// ReimageAllThenPoll performs ReimageAll then polls until it's completed +func (c VirtualMachineScaleSetsClient) ReimageAllThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.ReimageAll(ctx, id, input) + if err != nil { + return fmt.Errorf("performing ReimageAll: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ReimageAll: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_restart.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_restart.go new file mode 100644 index 00000000000..a39798d810f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_restart.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachineScaleSetsClient) Restart(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachineScaleSetsClient) RestartThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.Restart(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_setorchestrationservicestate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_setorchestrationservicestate.go new file mode 100644 index 00000000000..b6ffed9505d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_setorchestrationservicestate.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 SetOrchestrationServiceStateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// SetOrchestrationServiceState ... +func (c VirtualMachineScaleSetsClient) SetOrchestrationServiceState(ctx context.Context, id VirtualMachineScaleSetId, input OrchestrationServiceStateInput) (result SetOrchestrationServiceStateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/setOrchestrationServiceState", 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 +} + +// SetOrchestrationServiceStateThenPoll performs SetOrchestrationServiceState then polls until it's completed +func (c VirtualMachineScaleSetsClient) SetOrchestrationServiceStateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input OrchestrationServiceStateInput) error { + result, err := c.SetOrchestrationServiceState(ctx, id, input) + if err != nil { + return fmt.Errorf("performing SetOrchestrationServiceState: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after SetOrchestrationServiceState: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_start.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_start.go new file mode 100644 index 00000000000..687684b56c7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_start.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachineScaleSetsClient) Start(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachineScaleSetsClient) StartThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceIDs) error { + result, err := c.Start(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_update.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_update.go new file mode 100644 index 00000000000..f508f4deebf --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_update.go @@ -0,0 +1,107 @@ +package virtualmachinescalesets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSet +} + +type UpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VirtualMachineScaleSetsClient) Update(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetUpdate, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + OptionsObject: options, + 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 VirtualMachineScaleSetsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetUpdate, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/compute/2024-11-01/virtualmachinescalesets/method_updateinstances.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_updateinstances.go new file mode 100644 index 00000000000..9dc47df34a6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/method_updateinstances.go @@ -0,0 +1,74 @@ +package virtualmachinescalesets + +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 UpdateInstancesOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// UpdateInstances ... +func (c VirtualMachineScaleSetsClient) UpdateInstances(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs) (result UpdateInstancesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/manualupgrade", 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 +} + +// UpdateInstancesThenPoll performs UpdateInstances then polls until it's completed +func (c VirtualMachineScaleSetsClient) UpdateInstancesThenPoll(ctx context.Context, id VirtualMachineScaleSetId, input VirtualMachineScaleSetVMInstanceRequiredIDs) error { + result, err := c.UpdateInstances(ctx, id, input) + if err != nil { + return fmt.Errorf("performing UpdateInstances: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after UpdateInstances: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalcapabilities.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalcapabilities.go new file mode 100644 index 00000000000..bb5c75d6e23 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalcapabilities.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalunattendcontent.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalunattendcontent.go new file mode 100644 index 00000000000..7c084144227 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentNames `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassNames `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apientityreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apientityreference.go new file mode 100644 index 00000000000..b8430d55990 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apientityreference.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierror.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierror.go new file mode 100644 index 00000000000..c4e82b6e5b3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierror.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiError struct { + Code *string `json:"code,omitempty"` + Details *[]ApiErrorBase `json:"details,omitempty"` + Innererror *InnerError `json:"innererror,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierrorbase.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierrorbase.go new file mode 100644 index 00000000000..c1b7a79f5df --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_apierrorbase.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiErrorBase struct { + Code *string `json:"code,omitempty"` + Message *string `json:"message,omitempty"` + Target *string `json:"target,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_applicationprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_applicationprofile.go new file mode 100644 index 00000000000..4979d5eb29f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_applicationprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApplicationProfile struct { + GalleryApplications *[]VMGalleryApplication `json:"galleryApplications,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticosupgradepolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticosupgradepolicy.go new file mode 100644 index 00000000000..26fae1f0888 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticosupgradepolicy.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticOSUpgradePolicy struct { + DisableAutomaticRollback *bool `json:"disableAutomaticRollback,omitempty"` + EnableAutomaticOSUpgrade *bool `json:"enableAutomaticOSUpgrade,omitempty"` + OsRollingUpgradeDeferral *bool `json:"osRollingUpgradeDeferral,omitempty"` + UseRollingUpgradePolicy *bool `json:"useRollingUpgradePolicy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticrepairspolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticrepairspolicy.go new file mode 100644 index 00000000000..dd68e2cc826 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticrepairspolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticRepairsPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + GracePeriod *string `json:"gracePeriod,omitempty"` + RepairAction *RepairAction `json:"repairAction,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go new file mode 100644 index 00000000000..e1f421268e8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_automaticzonerebalancingpolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AutomaticZoneRebalancingPolicy struct { + Enabled *bool `json:"enabled,omitempty"` + RebalanceBehavior *RebalanceBehavior `json:"rebalanceBehavior,omitempty"` + RebalanceStrategy *RebalanceStrategy `json:"rebalanceStrategy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_billingprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_billingprofile.go new file mode 100644 index 00000000000..b69f9f26b52 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_billingprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BillingProfile struct { + MaxPrice *float64 `json:"maxPrice,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_bootdiagnostics.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_bootdiagnostics.go new file mode 100644 index 00000000000..2b5a0dcb5b0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_capacityreservationprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_capacityreservationprofile.go new file mode 100644 index 00000000000..ed6e492511b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_capacityreservationprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CapacityReservationProfile struct { + CapacityReservationGroup *SubResource `json:"capacityReservationGroup,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diagnosticsprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diagnosticsprofile.go new file mode 100644 index 00000000000..8423d9217b3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diffdisksettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diffdisksettings.go new file mode 100644 index 00000000000..9f3f1651366 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_encryptionidentity.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_encryptionidentity.go new file mode 100644 index 00000000000..d295df7bb90 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// 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 { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_eventgridandresourcegraph.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_eventgridandresourcegraph.go new file mode 100644 index 00000000000..bd58d30584d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_eventgridandresourcegraph.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EventGridAndResourceGraph struct { + Enable *bool `json:"enable,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_hostendpointsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_hostendpointsettings.go new file mode 100644 index 00000000000..6b1eaad7e92 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_imagereference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_imagereference.go new file mode 100644 index 00000000000..718ead8d889 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_imagereference.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_innererror.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_innererror.go new file mode 100644 index 00000000000..0700072f546 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_innererror.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InnerError struct { + Errordetail *string `json:"errordetail,omitempty"` + Exceptiontype *string `json:"exceptiontype,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_instanceviewstatus.go new file mode 100644 index 00000000000..a29cb5e5bb2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesets + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..c27479d1430 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxconfiguration.go new file mode 100644 index 00000000000..f86ad715bac --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxpatchsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxpatchsettings.go new file mode 100644 index 00000000000..0f31a50ca68 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..8d6cb04a3d3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicestateinput.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicestateinput.go new file mode 100644 index 00000000000..7e31615784b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicestateinput.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestrationServiceStateInput struct { + Action OrchestrationServiceStateAction `json:"action"` + ServiceName OrchestrationServiceNames `json:"serviceName"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicesummary.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicesummary.go new file mode 100644 index 00000000000..dde088b9649 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_orchestrationservicesummary.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OrchestrationServiceSummary struct { + ServiceName *OrchestrationServiceNames `json:"serviceName,omitempty"` + ServiceState *OrchestrationServiceState `json:"serviceState,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osimagenotificationprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osimagenotificationprofile.go new file mode 100644 index 00000000000..01f7a77997c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osimagenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSImageNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osprofileprovisioningdata.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osprofileprovisioningdata.go new file mode 100644 index 00000000000..cd887deb66f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_osprofileprovisioningdata.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileProvisioningData struct { + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_patchsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_patchsettings.go new file mode 100644 index 00000000000..23c367ad95b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_patchsettings.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_plan.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_plan.go new file mode 100644 index 00000000000..9d6837d0ec3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_plan.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_prioritymixpolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_prioritymixpolicy.go new file mode 100644 index 00000000000..e287abb09db --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_prioritymixpolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PriorityMixPolicy struct { + BaseRegularPriorityCount *int64 `json:"baseRegularPriorityCount,omitempty"` + RegularPriorityPercentageAboveBase *int64 `json:"regularPriorityPercentageAboveBase,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_proxyagentsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_proxyagentsettings.go new file mode 100644 index 00000000000..0e39733908a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_proxyagentsettings.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_publicipaddresssku.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_publicipaddresssku.go new file mode 100644 index 00000000000..25af0eadebb --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_recoverywalkresponse.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_recoverywalkresponse.go new file mode 100644 index 00000000000..1aacd4b4dde --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_recoverywalkresponse.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RecoveryWalkResponse struct { + NextPlatformUpdateDomain *int64 `json:"nextPlatformUpdateDomain,omitempty"` + WalkPerformed *bool `json:"walkPerformed,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resiliencypolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resiliencypolicy.go new file mode 100644 index 00000000000..1750227fab7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resiliencypolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResiliencyPolicy struct { + AutomaticZoneRebalancingPolicy *AutomaticZoneRebalancingPolicy `json:"automaticZoneRebalancingPolicy,omitempty"` + ResilientVMCreationPolicy *ResilientVMCreationPolicy `json:"resilientVMCreationPolicy,omitempty"` + ResilientVMDeletionPolicy *ResilientVMDeletionPolicy `json:"resilientVMDeletionPolicy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go new file mode 100644 index 00000000000..e2c35ecafc3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmcreationpolicy.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResilientVMCreationPolicy struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go new file mode 100644 index 00000000000..feff4983eb2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_resilientvmdeletionpolicy.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResilientVMDeletionPolicy struct { + Enabled *bool `json:"enabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollbackstatusinfo.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollbackstatusinfo.go new file mode 100644 index 00000000000..ecabe4651da --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollbackstatusinfo.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollbackStatusInfo struct { + FailedRolledbackInstanceCount *int64 `json:"failedRolledbackInstanceCount,omitempty"` + RollbackError *ApiError `json:"rollbackError,omitempty"` + SuccessfullyRolledbackInstanceCount *int64 `json:"successfullyRolledbackInstanceCount,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradepolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradepolicy.go new file mode 100644 index 00000000000..f8df6452f30 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradepolicy.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradePolicy struct { + EnableCrossZoneUpgrade *bool `json:"enableCrossZoneUpgrade,omitempty"` + MaxBatchInstancePercent *int64 `json:"maxBatchInstancePercent,omitempty"` + MaxSurge *bool `json:"maxSurge,omitempty"` + MaxUnhealthyInstancePercent *int64 `json:"maxUnhealthyInstancePercent,omitempty"` + MaxUnhealthyUpgradedInstancePercent *int64 `json:"maxUnhealthyUpgradedInstancePercent,omitempty"` + PauseTimeBetweenBatches *string `json:"pauseTimeBetweenBatches,omitempty"` + PrioritizeUnhealthyInstances *bool `json:"prioritizeUnhealthyInstances,omitempty"` + RollbackFailedInstancesOnPolicyBreach *bool `json:"rollbackFailedInstancesOnPolicyBreach,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go new file mode 100644 index 00000000000..3852391f39c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_rollingupgradeprogressinfo.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RollingUpgradeProgressInfo struct { + FailedInstanceCount *int64 `json:"failedInstanceCount,omitempty"` + InProgressInstanceCount *int64 `json:"inProgressInstanceCount,omitempty"` + PendingInstanceCount *int64 `json:"pendingInstanceCount,omitempty"` + SuccessfulInstanceCount *int64 `json:"successfulInstanceCount,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scaleinpolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scaleinpolicy.go new file mode 100644 index 00000000000..5684a6b4cb3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scaleinpolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScaleInPolicy struct { + ForceDeletion *bool `json:"forceDeletion,omitempty"` + PrioritizeUnhealthyVMs *bool `json:"prioritizeUnhealthyVMs,omitempty"` + Rules *[]VirtualMachineScaleSetScaleInRules `json:"rules,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go new file mode 100644 index 00000000000..bc383cb9b33 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsadditionalpublishingtargets.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsAdditionalPublishingTargets struct { + EventGridAndResourceGraph *EventGridAndResourceGraph `json:"eventGridAndResourceGraph,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventspolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventspolicy.go new file mode 100644 index 00000000000..913c9da042c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventspolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsPolicy struct { + ScheduledEventsAdditionalPublishingTargets *ScheduledEventsAdditionalPublishingTargets `json:"scheduledEventsAdditionalPublishingTargets,omitempty"` + UserInitiatedReboot *UserInitiatedReboot `json:"userInitiatedReboot,omitempty"` + UserInitiatedRedeploy *UserInitiatedRedeploy `json:"userInitiatedRedeploy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsprofile.go new file mode 100644 index 00000000000..25e3a7ffd6d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_scheduledeventsprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ScheduledEventsProfile struct { + OsImageNotificationProfile *OSImageNotificationProfile `json:"osImageNotificationProfile,omitempty"` + TerminateNotificationProfile *TerminateNotificationProfile `json:"terminateNotificationProfile,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereference.go new file mode 100644 index 00000000000..21be9e6cdbd --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereference.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPostureReference struct { + ExcludeExtensions *[]string `json:"excludeExtensions,omitempty"` + Id string `json:"id"` + IsOverridable *bool `json:"isOverridable,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereferenceupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereferenceupdate.go new file mode 100644 index 00000000000..e39c521ee58 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityposturereferenceupdate.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityPostureReferenceUpdate struct { + ExcludeExtensions *[]string `json:"excludeExtensions,omitempty"` + Id *string `json:"id,omitempty"` + IsOverridable *bool `json:"isOverridable,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityprofile.go new file mode 100644 index 00000000000..cb9223bca85 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_securityprofile.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_serviceartifactreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_serviceartifactreference.go new file mode 100644 index 00000000000..551c4ae1049 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_serviceartifactreference.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServiceArtifactReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sku.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sku.go new file mode 100644 index 00000000000..15a2fdc0616 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sku.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofile.go new file mode 100644 index 00000000000..4036ce3128a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProfile struct { + AllocationStrategy *AllocationStrategy `json:"allocationStrategy,omitempty"` + VMSizes *[]SkuProfileVMSize `json:"vmSizes,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofilevmsize.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofilevmsize.go new file mode 100644 index 00000000000..afbbc66942e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_skuprofilevmsize.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SkuProfileVMSize struct { + Name *string `json:"name,omitempty"` + Rank *int64 `json:"rank,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_spotrestorepolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_spotrestorepolicy.go new file mode 100644 index 00000000000..7ee643d9bc1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_spotrestorepolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SpotRestorePolicy struct { + Enabled *bool `json:"enabled,omitempty"` + RestoreTimeout *string `json:"restoreTimeout,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshconfiguration.go new file mode 100644 index 00000000000..f753251b5f7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshpublickey.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshpublickey.go new file mode 100644 index 00000000000..489608153b4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_sshpublickey.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_subresource.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_subresource.go new file mode 100644 index 00000000000..a7ddcb87058 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_terminatenotificationprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_terminatenotificationprofile.go new file mode 100644 index 00000000000..8152ca787d0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_terminatenotificationprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TerminateNotificationProfile struct { + Enable *bool `json:"enable,omitempty"` + NotBeforeTimeout *string `json:"notBeforeTimeout,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_uefisettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_uefisettings.go new file mode 100644 index 00000000000..0f9f555ac1c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_uefisettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go new file mode 100644 index 00000000000..18769cefc72 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfo.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoricalStatusInfo struct { + Location *string `json:"location,omitempty"` + Properties *UpgradeOperationHistoricalStatusInfoProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go new file mode 100644 index 00000000000..9a195b52b4d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistoricalstatusinfoproperties.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoricalStatusInfoProperties struct { + Error *ApiError `json:"error,omitempty"` + Progress *RollingUpgradeProgressInfo `json:"progress,omitempty"` + RollbackInfo *RollbackStatusInfo `json:"rollbackInfo,omitempty"` + RunningStatus *UpgradeOperationHistoryStatus `json:"runningStatus,omitempty"` + StartedBy *UpgradeOperationInvoker `json:"startedBy,omitempty"` + TargetImageReference *ImageReference `json:"targetImageReference,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go new file mode 100644 index 00000000000..9b295dd5586 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradeoperationhistorystatus.go @@ -0,0 +1,40 @@ +package virtualmachinescalesets + +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 UpgradeOperationHistoryStatus struct { + Code *UpgradeState `json:"code,omitempty"` + EndTime *string `json:"endTime,omitempty"` + StartTime *string `json:"startTime,omitempty"` +} + +func (o *UpgradeOperationHistoryStatus) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeOperationHistoryStatus) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *UpgradeOperationHistoryStatus) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *UpgradeOperationHistoryStatus) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradepolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradepolicy.go new file mode 100644 index 00000000000..274f574700a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_upgradepolicy.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradePolicy struct { + AutomaticOSUpgradePolicy *AutomaticOSUpgradePolicy `json:"automaticOSUpgradePolicy,omitempty"` + Mode *UpgradeMode `json:"mode,omitempty"` + RollingUpgradePolicy *RollingUpgradePolicy `json:"rollingUpgradePolicy,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedreboot.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedreboot.go new file mode 100644 index 00000000000..2a40c2ce0a0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedreboot.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedReboot struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedredeploy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedredeploy.go new file mode 100644 index 00000000000..56fb85e872b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_userinitiatedredeploy.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UserInitiatedRedeploy struct { + AutomaticallyApprove *bool `json:"automaticallyApprove,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultcertificate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultcertificate.go new file mode 100644 index 00000000000..4e9173b39e6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultsecretgroup.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultsecretgroup.go new file mode 100644 index 00000000000..4e737daf929 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualharddisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualharddisk.go new file mode 100644 index 00000000000..da6fa628059 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescaleset.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescaleset.go new file mode 100644 index 00000000000..3660d56b217 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescaleset.go @@ -0,0 +1,25 @@ +package virtualmachinescalesets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones" + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 VirtualMachineScaleSet struct { + Etag *string `json:"etag,omitempty"` + ExtendedLocation *edgezones.Model `json:"extendedLocation,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go new file mode 100644 index 00000000000..99a4db2cd26 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetdatadisk.go @@ -0,0 +1,17 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetDataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go new file mode 100644 index 00000000000..d28ca76627f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextension.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtension struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go new file mode 100644 index 00000000000..c16c1e62d7b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProfile struct { + Extensions *[]VirtualMachineScaleSetExtension `json:"extensions,omitempty"` + ExtensionsTimeBudget *string `json:"extensionsTimeBudget,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go new file mode 100644 index 00000000000..ab08726d81e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetextensionproperties.go @@ -0,0 +1,19 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go new file mode 100644 index 00000000000..844a041b715 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesethardwareprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetHardwareProfile struct { + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go new file mode 100644 index 00000000000..f7f4c1d937d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceview.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetInstanceView struct { + Extensions *[]VirtualMachineScaleSetVMExtensionsSummary `json:"extensions,omitempty"` + OrchestrationServices *[]OrchestrationServiceSummary `json:"orchestrationServices,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VirtualMachine *VirtualMachineScaleSetInstanceViewStatusesSummary `json:"virtualMachine,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go new file mode 100644 index 00000000000..da9756a65e8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetinstanceviewstatusessummary.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetInstanceViewStatusesSummary struct { + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go new file mode 100644 index 00000000000..a474d72203b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go new file mode 100644 index 00000000000..60ed5574205 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetipconfigurationproperties.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go new file mode 100644 index 00000000000..d5041eaa002 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetiptag.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go new file mode 100644 index 00000000000..62742dc4763 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetmanageddiskparameters.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go new file mode 100644 index 00000000000..f9a4616d1d7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go new file mode 100644 index 00000000000..b3b28195210 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationdnssettings.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationDnsSettings struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go new file mode 100644 index 00000000000..2a346c19dce --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go new file mode 100644 index 00000000000..e15f8580162 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetnetworkprofile.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkProfile struct { + HealthProbe *ApiEntityReference `json:"healthProbe,omitempty"` + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go new file mode 100644 index 00000000000..0cc179b304b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosdisk.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + VhdContainers *[]string `json:"vhdContainers,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go new file mode 100644 index 00000000000..b1bbc5e5dd4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetosprofile.go @@ -0,0 +1,16 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetOSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerNamePrefix *string `json:"computerNamePrefix,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go new file mode 100644 index 00000000000..9bf648bbc83 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetproperties.go @@ -0,0 +1,48 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + ConstrainedMaximumCapacity *bool `json:"constrainedMaximumCapacity,omitempty"` + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + HostGroup *SubResource `json:"hostGroup,omitempty"` + OrchestrationMode *OrchestrationMode `json:"orchestrationMode,omitempty"` + Overprovision *bool `json:"overprovision,omitempty"` + PlatformFaultDomainCount *int64 `json:"platformFaultDomainCount,omitempty"` + PriorityMixPolicy *PriorityMixPolicy `json:"priorityMixPolicy,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ResiliencyPolicy *ResiliencyPolicy `json:"resiliencyPolicy,omitempty"` + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + ScheduledEventsPolicy *ScheduledEventsPolicy `json:"scheduledEventsPolicy,omitempty"` + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + SkuProfile *SkuProfile `json:"skuProfile,omitempty"` + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UniqueId *string `json:"uniqueId,omitempty"` + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + VirtualMachineProfile *VirtualMachineScaleSetVMProfile `json:"virtualMachineProfile,omitempty"` + ZonalPlatformFaultDomainAlignMode *ZonalPlatformFaultDomainAlignMode `json:"zonalPlatformFaultDomainAlignMode,omitempty"` + ZoneBalance *bool `json:"zoneBalance,omitempty"` +} + +func (o *VirtualMachineScaleSetProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go new file mode 100644 index 00000000000..12b8b08bf35 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go new file mode 100644 index 00000000000..f35d4c26550 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..eb4ea50962b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go new file mode 100644 index 00000000000..e14bf36b233 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetreimageparameters.go @@ -0,0 +1,12 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetReimageParameters struct { + ExactVersion *string `json:"exactVersion,omitempty"` + ForceUpdateOSDiskForEphemeral *bool `json:"forceUpdateOSDiskForEphemeral,omitempty"` + InstanceIds *[]string `json:"instanceIds,omitempty"` + OsProfile *OSProfileProvisioningData `json:"osProfile,omitempty"` + TempDisk *bool `json:"tempDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go new file mode 100644 index 00000000000..dda5b916c20 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetsku.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetSku struct { + Capacity *VirtualMachineScaleSetSkuCapacity `json:"capacity,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` + Sku *Sku `json:"sku,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go new file mode 100644 index 00000000000..8ed0fd37617 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetskucapacity.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetSkuCapacity struct { + DefaultCapacity *int64 `json:"defaultCapacity,omitempty"` + Maximum *int64 `json:"maximum,omitempty"` + Minimum *int64 `json:"minimum,omitempty"` + ScaleType *VirtualMachineScaleSetSkuScaleType `json:"scaleType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go new file mode 100644 index 00000000000..8424fc4d26a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetstorageprofile.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetStorageProfile struct { + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *string `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *VirtualMachineScaleSetOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go new file mode 100644 index 00000000000..9be4349f801 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdate.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 VirtualMachineScaleSetUpdate struct { + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetUpdateProperties `json:"properties,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go new file mode 100644 index 00000000000..702a011b11f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateIPConfiguration struct { + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetUpdateIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go new file mode 100644 index 00000000000..f8bf924d92f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateipconfigurationproperties.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetUpdatePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go new file mode 100644 index 00000000000..2e4ea7e2978 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateNetworkConfiguration struct { + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetUpdateNetworkConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go new file mode 100644 index 00000000000..8b2cf14e02b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations *[]VirtualMachineScaleSetUpdateIPConfiguration `json:"ipConfigurations,omitempty"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go new file mode 100644 index 00000000000..1de04625646 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatenetworkprofile.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateNetworkProfile struct { + HealthProbe *ApiEntityReference `json:"healthProbe,omitempty"` + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetUpdateNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go new file mode 100644 index 00000000000..42564d5c007 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosdisk.go @@ -0,0 +1,15 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateOSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *VirtualMachineScaleSetManagedDiskParameters `json:"managedDisk,omitempty"` + VhdContainers *[]string `json:"vhdContainers,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go new file mode 100644 index 00000000000..a08ca7e2c73 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateosprofile.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateOSProfile struct { + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go new file mode 100644 index 00000000000..192a5d7b54f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdateproperties.go @@ -0,0 +1,21 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AutomaticRepairsPolicy *AutomaticRepairsPolicy `json:"automaticRepairsPolicy,omitempty"` + DoNotRunExtensionsOnOverprovisionedVMs *bool `json:"doNotRunExtensionsOnOverprovisionedVMs,omitempty"` + Overprovision *bool `json:"overprovision,omitempty"` + PriorityMixPolicy *PriorityMixPolicy `json:"priorityMixPolicy,omitempty"` + ProximityPlacementGroup *SubResource `json:"proximityPlacementGroup,omitempty"` + ResiliencyPolicy *ResiliencyPolicy `json:"resiliencyPolicy,omitempty"` + ScaleInPolicy *ScaleInPolicy `json:"scaleInPolicy,omitempty"` + SinglePlacementGroup *bool `json:"singlePlacementGroup,omitempty"` + SkuProfile *SkuProfile `json:"skuProfile,omitempty"` + SpotRestorePolicy *SpotRestorePolicy `json:"spotRestorePolicy,omitempty"` + UpgradePolicy *UpgradePolicy `json:"upgradePolicy,omitempty"` + VirtualMachineProfile *VirtualMachineScaleSetUpdateVMProfile `json:"virtualMachineProfile,omitempty"` + ZonalPlatformFaultDomainAlignMode *ZonalPlatformFaultDomainAlignMode `json:"zonalPlatformFaultDomainAlignMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go new file mode 100644 index 00000000000..251121d51b0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdatePublicIPAddressConfiguration struct { + Name *string `json:"name,omitempty"` + Properties *VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..1103592c3b7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatepublicipaddressconfigurationproperties.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdatePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go new file mode 100644 index 00000000000..0a022ffbc43 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatestorageprofile.go @@ -0,0 +1,11 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateStorageProfile struct { + DataDisks *[]VirtualMachineScaleSetDataDisk `json:"dataDisks,omitempty"` + DiskControllerType *string `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *VirtualMachineScaleSetUpdateOSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go new file mode 100644 index 00000000000..ae6a7c875ef --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetupdatevmprofile.go @@ -0,0 +1,19 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetUpdateVMProfile struct { + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *VirtualMachineScaleSetUpdateNetworkProfile `json:"networkProfile,omitempty"` + OsProfile *VirtualMachineScaleSetUpdateOSProfile `json:"osProfile,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityPostureReference *SecurityPostureReferenceUpdate `json:"securityPostureReference,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *VirtualMachineScaleSetUpdateStorageProfile `json:"storageProfile,omitempty"` + UserData *string `json:"userData,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go new file mode 100644 index 00000000000..17129893f61 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmextensionssummary.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtensionsSummary struct { + Name *string `json:"name,omitempty"` + StatusesSummary *[]VirtualMachineStatusCodeCount `json:"statusesSummary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go new file mode 100644 index 00000000000..aaad4fdde84 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstanceids.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMInstanceIDs struct { + InstanceIds *[]string `json:"instanceIds,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go new file mode 100644 index 00000000000..c062f66e5f3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvminstancerequiredids.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMInstanceRequiredIDs struct { + InstanceIds []string `json:"instanceIds"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go new file mode 100644 index 00000000000..27fd00259fc --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinescalesetvmprofile.go @@ -0,0 +1,43 @@ +package virtualmachinescalesets + +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 VirtualMachineScaleSetVMProfile struct { + ApplicationProfile *ApplicationProfile `json:"applicationProfile,omitempty"` + BillingProfile *BillingProfile `json:"billingProfile,omitempty"` + CapacityReservation *CapacityReservationProfile `json:"capacityReservation,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + EvictionPolicy *VirtualMachineEvictionPolicyTypes `json:"evictionPolicy,omitempty"` + ExtensionProfile *VirtualMachineScaleSetExtensionProfile `json:"extensionProfile,omitempty"` + HardwareProfile *VirtualMachineScaleSetHardwareProfile `json:"hardwareProfile,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + NetworkProfile *VirtualMachineScaleSetNetworkProfile `json:"networkProfile,omitempty"` + OsProfile *VirtualMachineScaleSetOSProfile `json:"osProfile,omitempty"` + Priority *VirtualMachinePriorityTypes `json:"priority,omitempty"` + ScheduledEventsProfile *ScheduledEventsProfile `json:"scheduledEventsProfile,omitempty"` + SecurityPostureReference *SecurityPostureReference `json:"securityPostureReference,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + ServiceArtifactReference *ServiceArtifactReference `json:"serviceArtifactReference,omitempty"` + StorageProfile *VirtualMachineScaleSetStorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` +} + +func (o *VirtualMachineScaleSetVMProfile) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetVMProfile) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go new file mode 100644 index 00000000000..3a836612f78 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_virtualmachinestatuscodecount.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineStatusCodeCount struct { + Code *string `json:"code,omitempty"` + Count *int64 `json:"count,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmdisksecurityprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..9f089766d67 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmgalleryapplication.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmgalleryapplication.go new file mode 100644 index 00000000000..6bfd25f6a47 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmgalleryapplication.go @@ -0,0 +1,13 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMGalleryApplication struct { + ConfigurationReference *string `json:"configurationReference,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + Order *int64 `json:"order,omitempty"` + PackageReferenceId string `json:"packageReferenceId"` + Tags *string `json:"tags,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go new file mode 100644 index 00000000000..7ef0c90ecf1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmscalesetconverttosingleplacementgroupinput.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMScaleSetConvertToSinglePlacementGroupInput struct { + ActivePlacementGroupId *string `json:"activePlacementGroupId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmsizeproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmsizeproperties.go new file mode 100644 index 00000000000..07f2433ca4a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsconfiguration.go new file mode 100644 index 00000000000..ff1f44929f5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..3a2358f7cb4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmconfiguration.go new file mode 100644 index 00000000000..de3ef359e0f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmlistener.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmlistener.go new file mode 100644 index 00000000000..fbaee700c4e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/model_winrmlistener.go @@ -0,0 +1,9 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/predicates.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/predicates.go new file mode 100644 index 00000000000..3936b21e239 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/predicates.go @@ -0,0 +1,68 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpgradeOperationHistoricalStatusInfoOperationPredicate struct { + Location *string + Type *string +} + +func (p UpgradeOperationHistoricalStatusInfoOperationPredicate) Matches(input UpgradeOperationHistoricalStatusInfo) bool { + + if p.Location != nil && (input.Location == nil || *p.Location != *input.Location) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} + +type VirtualMachineScaleSetOperationPredicate struct { + Etag *string + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetOperationPredicate) Matches(input VirtualMachineScaleSet) 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 +} + +type VirtualMachineScaleSetSkuOperationPredicate struct { + ResourceType *string +} + +func (p VirtualMachineScaleSetSkuOperationPredicate) Matches(input VirtualMachineScaleSetSku) bool { + + if p.ResourceType != nil && (input.ResourceType == nil || *p.ResourceType != *input.ResourceType) { + return false + } + + return true +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesets/version.go b/resource-manager/compute/2024-11-01/virtualmachinescalesets/version.go new file mode 100644 index 00000000000..c43d062ca6a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesets/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesets + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesets/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/README.md b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/README.md new file mode 100644 index 00000000000..06318522872 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/README.md @@ -0,0 +1,98 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions` Documentation + +The `virtualmachinescalesetvmextensions` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachinescalesetvmextensions" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetvmextensions.NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +payload := virtualmachinescalesetvmextensions.VirtualMachineScaleSetVMExtension{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +read, err := client.Get(ctx, id, virtualmachinescalesetvmextensions.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.List(ctx, id, virtualmachinescalesetvmextensions.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMExtensionsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmextensions.NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + +payload := virtualmachinescalesetvmextensions.VirtualMachineScaleSetVMExtensionUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/client.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/client.go new file mode 100644 index 00000000000..384674618ef --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetvmextensions + +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 VirtualMachineScaleSetVMExtensionsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetVMExtensionsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetVMExtensionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetvmextensions", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetVMExtensionsClient: %+v", err) + } + + return &VirtualMachineScaleSetVMExtensionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/constants.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/constants.go new file mode 100644 index 00000000000..3a564dc878a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/constants.go @@ -0,0 +1,54 @@ +package virtualmachinescalesetvmextensions + +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 StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go new file mode 100644 index 00000000000..52f7976168f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension.go @@ -0,0 +1,148 @@ +package virtualmachinescalesetvmextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineExtensionId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineExtensionId{} + +// VirtualMachineExtensionId is a struct representing the Resource ID for a Virtual Machine Extension +type VirtualMachineExtensionId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string + ExtensionName string +} + +// NewVirtualMachineExtensionID returns a new VirtualMachineExtensionId struct +func NewVirtualMachineExtensionID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string, extensionName string) VirtualMachineExtensionId { + return VirtualMachineExtensionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + ExtensionName: extensionName, + } +} + +// ParseVirtualMachineExtensionID parses 'input' into a VirtualMachineExtensionId +func ParseVirtualMachineExtensionID(input string) (*VirtualMachineExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineExtensionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineExtensionIDInsensitively parses 'input' case-insensitively into a VirtualMachineExtensionId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineExtensionIDInsensitively(input string) (*VirtualMachineExtensionId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineExtensionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineExtensionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineExtensionId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + if id.ExtensionName, ok = input.Parsed["extensionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "extensionName", input) + } + + return nil +} + +// ValidateVirtualMachineExtensionID checks that 'input' can be parsed as a Virtual Machine Extension ID +func ValidateVirtualMachineExtensionID(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 := ParseVirtualMachineExtensionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Extension ID +func (id VirtualMachineExtensionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/extensions/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId, id.ExtensionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Extension ID +func (id VirtualMachineExtensionId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + resourceids.StaticSegment("staticExtensions", "extensions", "extensions"), + resourceids.UserSpecifiedSegment("extensionName", "extensionName"), + } +} + +// String returns a human-readable description of this Virtual Machine Extension ID +func (id VirtualMachineExtensionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + fmt.Sprintf("Extension Name: %q", id.ExtensionName), + } + return fmt.Sprintf("Virtual Machine Extension (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go new file mode 100644 index 00000000000..fb282110d45 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachineextension_test.go @@ -0,0 +1,372 @@ +package virtualmachinescalesetvmextensions + +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 = &VirtualMachineExtensionId{} + +func TestNewVirtualMachineExtensionID(t *testing.T) { + id := NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } + + if id.ExtensionName != "extensionName" { + t.Fatalf("Expected %q but got %q for Segment 'ExtensionName'", id.ExtensionName, "extensionName") + } +} + +func TestFormatVirtualMachineExtensionID(t *testing.T) { + actual := NewVirtualMachineExtensionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "extensionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineExtensionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineExtensionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName", + Expected: &VirtualMachineExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineExtensionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestParseVirtualMachineExtensionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineExtensionId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/eXtEnSiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName", + Expected: &VirtualMachineExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + ExtensionName: "extensionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extensions/extensionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/eXtEnSiOnS/eXtEnSiOnNaMe", + Expected: &VirtualMachineExtensionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + ExtensionName: "eXtEnSiOnNaMe", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/eXtEnSiOnS/eXtEnSiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineExtensionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.ExtensionName != v.Expected.ExtensionName { + t.Fatalf("Expected %q but got %q for ExtensionName", v.Expected.ExtensionName, actual.ExtensionName) + } + + } +} + +func TestSegmentsForVirtualMachineExtensionId(t *testing.T) { + segments := VirtualMachineExtensionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineExtensionId 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/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go new file mode 100644 index 00000000000..4cc5c767617 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetvmextensions + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetVirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +// VirtualMachineScaleSetVirtualMachineId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine +type VirtualMachineScaleSetVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string +} + +// NewVirtualMachineScaleSetVirtualMachineID returns a new VirtualMachineScaleSetVirtualMachineId struct +func NewVirtualMachineScaleSetVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string) VirtualMachineScaleSetVirtualMachineId { + return VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineID parses 'input' into a VirtualMachineScaleSetVirtualMachineId +func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID +func ValidateVirtualMachineScaleSetVirtualMachineID(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 := ParseVirtualMachineScaleSetVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go new file mode 100644 index 00000000000..ef02f2a5f61 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/id_virtualmachinescalesetvirtualmachine_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetvmextensions + +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 = &VirtualMachineScaleSetVirtualMachineId{} + +func TestNewVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineId 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/compute/2024-11-01/virtualmachinescalesetvmextensions/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_createorupdate.go new file mode 100644 index 00000000000..46ef08d1f08 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvmextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVMExtension +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtension) (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 VirtualMachineScaleSetVMExtensionsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtension) 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/compute/2024-11-01/virtualmachinescalesetvmextensions/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_delete.go new file mode 100644 index 00000000000..5d5bc88108a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachinescalesetvmextensions + +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 VirtualMachineScaleSetVMExtensionsClient) Delete(ctx context.Context, id VirtualMachineExtensionId) (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 VirtualMachineScaleSetVMExtensionsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineExtensionId) 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/compute/2024-11-01/virtualmachinescalesetvmextensions/method_get.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_get.go new file mode 100644 index 00000000000..03923b1ef4d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvmextensions + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVMExtension +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetVMExtensionsClient) Get(ctx context.Context, id VirtualMachineExtensionId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSetVMExtension + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_list.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_list.go new file mode 100644 index 00000000000..300d802904c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_list.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvmextensions + +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 *VirtualMachineScaleSetVMExtensionsListResult +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// List ... +func (c VirtualMachineScaleSetVMExtensionsClient) List(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: fmt.Sprintf("%s/extensions", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSetVMExtensionsListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_update.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_update.go new file mode 100644 index 00000000000..a0bf00c1157 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/method_update.go @@ -0,0 +1,74 @@ +package virtualmachinescalesetvmextensions + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVMExtension +} + +// Update ... +func (c VirtualMachineScaleSetVMExtensionsClient) Update(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtensionUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 VirtualMachineScaleSetVMExtensionsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineExtensionId, input VirtualMachineScaleSetVMExtensionUpdate) 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/compute/2024-11-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go new file mode 100644 index 00000000000..888a36f4514 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesetvmextensions + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..b94a17b7d3d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_subresource.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_subresource.go new file mode 100644 index 00000000000..29f079f3bdb --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..951deccdde8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..fcea791e563 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go new file mode 100644 index 00000000000..e367a5a9095 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachineextensionupdateproperties.go @@ -0,0 +1,17 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionUpdateProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go new file mode 100644 index 00000000000..d8eb6bedf08 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextension.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtension struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go new file mode 100644 index 00000000000..207a4ce0a1c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionslistresult.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtensionsListResult struct { + Value *[]VirtualMachineScaleSetVMExtension `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go new file mode 100644 index 00000000000..01cf7321b21 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/model_virtualmachinescalesetvmextensionupdate.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMExtensionUpdate struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionUpdateProperties `json:"properties,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/version.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/version.go new file mode 100644 index 00000000000..389e62b3458 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmextensions/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvmextensions + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetvmextensions/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/README.md b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/README.md new file mode 100644 index 00000000000..de2aa0f509a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/README.md @@ -0,0 +1,99 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands` Documentation + +The `virtualmachinescalesetvmruncommands` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachinescalesetvmruncommands" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVMRunCommandsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +payload := virtualmachinescalesetvmruncommands.VirtualMachineRunCommand{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +read, err := client.Get(ctx, id, virtualmachinescalesetvmruncommands.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +// alternatively `client.List(ctx, id, virtualmachinescalesetvmruncommands.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachinescalesetvmruncommands.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMRunCommandsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvmruncommands.NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + +payload := virtualmachinescalesetvmruncommands.VirtualMachineRunCommandUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/client.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/client.go new file mode 100644 index 00000000000..fb8224b7dda --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetvmruncommands + +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 VirtualMachineScaleSetVMRunCommandsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetVMRunCommandsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetVMRunCommandsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetvmruncommands", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetVMRunCommandsClient: %+v", err) + } + + return &VirtualMachineScaleSetVMRunCommandsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/constants.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/constants.go new file mode 100644 index 00000000000..c7afd977707 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/constants.go @@ -0,0 +1,110 @@ +package virtualmachinescalesetvmruncommands + +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 ExecutionState string + +const ( + ExecutionStateCanceled ExecutionState = "Canceled" + ExecutionStateFailed ExecutionState = "Failed" + ExecutionStatePending ExecutionState = "Pending" + ExecutionStateRunning ExecutionState = "Running" + ExecutionStateSucceeded ExecutionState = "Succeeded" + ExecutionStateTimedOut ExecutionState = "TimedOut" + ExecutionStateUnknown ExecutionState = "Unknown" +) + +func PossibleValuesForExecutionState() []string { + return []string{ + string(ExecutionStateCanceled), + string(ExecutionStateFailed), + string(ExecutionStatePending), + string(ExecutionStateRunning), + string(ExecutionStateSucceeded), + string(ExecutionStateTimedOut), + string(ExecutionStateUnknown), + } +} + +func (s *ExecutionState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseExecutionState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseExecutionState(input string) (*ExecutionState, error) { + vals := map[string]ExecutionState{ + "canceled": ExecutionStateCanceled, + "failed": ExecutionStateFailed, + "pending": ExecutionStatePending, + "running": ExecutionStateRunning, + "succeeded": ExecutionStateSucceeded, + "timedout": ExecutionStateTimedOut, + "unknown": ExecutionStateUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ExecutionState(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go new file mode 100644 index 00000000000..5aad888a916 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetvmruncommands + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetVirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +// VirtualMachineScaleSetVirtualMachineId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine +type VirtualMachineScaleSetVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string +} + +// NewVirtualMachineScaleSetVirtualMachineID returns a new VirtualMachineScaleSetVirtualMachineId struct +func NewVirtualMachineScaleSetVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string) VirtualMachineScaleSetVirtualMachineId { + return VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineID parses 'input' into a VirtualMachineScaleSetVirtualMachineId +func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID +func ValidateVirtualMachineScaleSetVirtualMachineID(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 := ParseVirtualMachineScaleSetVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go new file mode 100644 index 00000000000..f8746c63c07 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachine_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetvmruncommands + +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 = &VirtualMachineScaleSetVirtualMachineId{} + +func TestNewVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineId 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/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go new file mode 100644 index 00000000000..447f4dcb0c2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand.go @@ -0,0 +1,148 @@ +package virtualmachinescalesetvmruncommands + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetVirtualMachineRunCommandId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineRunCommandId{} + +// VirtualMachineScaleSetVirtualMachineRunCommandId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine Run Command +type VirtualMachineScaleSetVirtualMachineRunCommandId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string + RunCommandName string +} + +// NewVirtualMachineScaleSetVirtualMachineRunCommandID returns a new VirtualMachineScaleSetVirtualMachineRunCommandId struct +func NewVirtualMachineScaleSetVirtualMachineRunCommandID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string, runCommandName string) VirtualMachineScaleSetVirtualMachineRunCommandId { + return VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + RunCommandName: runCommandName, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineRunCommandID parses 'input' into a VirtualMachineScaleSetVirtualMachineRunCommandId +func ParseVirtualMachineScaleSetVirtualMachineRunCommandID(input string) (*VirtualMachineScaleSetVirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineRunCommandId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineRunCommandId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineRunCommandId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineRunCommandId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineRunCommandId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + if id.RunCommandName, ok = input.Parsed["runCommandName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "runCommandName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineRunCommandID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine Run Command ID +func ValidateVirtualMachineScaleSetVirtualMachineRunCommandID(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 := ParseVirtualMachineScaleSetVirtualMachineRunCommandID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine Run Command ID +func (id VirtualMachineScaleSetVirtualMachineRunCommandId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s/runCommands/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId, id.RunCommandName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine Run Command ID +func (id VirtualMachineScaleSetVirtualMachineRunCommandId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + resourceids.StaticSegment("staticRunCommands", "runCommands", "runCommands"), + resourceids.UserSpecifiedSegment("runCommandName", "runCommandName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine Run Command ID +func (id VirtualMachineScaleSetVirtualMachineRunCommandId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + fmt.Sprintf("Run Command Name: %q", id.RunCommandName), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine Run Command (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go new file mode 100644 index 00000000000..e337b87a196 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/id_virtualmachinescalesetvirtualmachineruncommand_test.go @@ -0,0 +1,372 @@ +package virtualmachinescalesetvmruncommands + +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 = &VirtualMachineScaleSetVirtualMachineRunCommandId{} + +func TestNewVirtualMachineScaleSetVirtualMachineRunCommandID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } + + if id.RunCommandName != "runCommandName" { + t.Fatalf("Expected %q but got %q for Segment 'RunCommandName'", id.RunCommandName, "runCommandName") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineRunCommandID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineRunCommandID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId", "runCommandName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineRunCommandID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineRunCommandId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName", + Expected: &VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineRunCommandID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineRunCommandId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/rUnCoMmAnDs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName", + Expected: &VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + RunCommandName: "runCommandName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/runCommands/runCommandName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/rUnCoMmAnDs/rUnCoMmAnDnAmE", + Expected: &VirtualMachineScaleSetVirtualMachineRunCommandId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + RunCommandName: "rUnCoMmAnDnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/rUnCoMmAnDs/rUnCoMmAnDnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineRunCommandIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + if actual.RunCommandName != v.Expected.RunCommandName { + t.Fatalf("Expected %q but got %q for RunCommandName", v.Expected.RunCommandName, actual.RunCommandName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineRunCommandId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineRunCommandId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineRunCommandId 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/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_createorupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_createorupdate.go new file mode 100644 index 00000000000..b02c921d34e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvmruncommands + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +// CreateOrUpdate ... +func (c VirtualMachineScaleSetVMRunCommandsClient) CreateOrUpdate(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommand) (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 VirtualMachineScaleSetVMRunCommandsClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommand) 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/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_delete.go new file mode 100644 index 00000000000..739ea1ef99a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_delete.go @@ -0,0 +1,71 @@ +package virtualmachinescalesetvmruncommands + +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 VirtualMachineScaleSetVMRunCommandsClient) Delete(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId) (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 VirtualMachineScaleSetVMRunCommandsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId) 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/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_get.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_get.go new file mode 100644 index 00000000000..7504f816267 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvmruncommands + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +type GetOperationOptions struct { + Expand *string +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetVMRunCommandsClient) Get(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineRunCommand + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_list.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_list.go new file mode 100644 index 00000000000..14ad4b942ca --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_list.go @@ -0,0 +1,134 @@ +package virtualmachinescalesetvmruncommands + +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 *[]VirtualMachineRunCommand +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineRunCommand +} + +type ListOperationOptions struct { + Expand *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetVMRunCommandsClient) List(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/runCommands", 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 *[]VirtualMachineRunCommand `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 VirtualMachineScaleSetVMRunCommandsClient) ListComplete(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualMachineRunCommandOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetVMRunCommandsClient) ListCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options ListOperationOptions, predicate VirtualMachineRunCommandOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineRunCommand, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_update.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_update.go new file mode 100644 index 00000000000..083579e6b72 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/method_update.go @@ -0,0 +1,74 @@ +package virtualmachinescalesetvmruncommands + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineRunCommand +} + +// Update ... +func (c VirtualMachineScaleSetVMRunCommandsClient) Update(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 VirtualMachineScaleSetVMRunCommandsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineRunCommandId, input VirtualMachineRunCommandUpdate) 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/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go new file mode 100644 index 00000000000..83940dc765f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesetvmruncommands + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go new file mode 100644 index 00000000000..f69bb471974 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go new file mode 100644 index 00000000000..1cbfaf8c306 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_runcommandmanagedidentity.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandManagedIdentity struct { + ClientId *string `json:"clientId,omitempty"` + ObjectId *string `json:"objectId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go new file mode 100644 index 00000000000..8e559c717b0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommand.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommand struct { + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go new file mode 100644 index 00000000000..b2040f55f7d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandinstanceview.go @@ -0,0 +1,45 @@ +package virtualmachinescalesetvmruncommands + +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 VirtualMachineRunCommandInstanceView struct { + EndTime *string `json:"endTime,omitempty"` + Error *string `json:"error,omitempty"` + ExecutionMessage *string `json:"executionMessage,omitempty"` + ExecutionState *ExecutionState `json:"executionState,omitempty"` + ExitCode *int64 `json:"exitCode,omitempty"` + Output *string `json:"output,omitempty"` + StartTime *string `json:"startTime,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} + +func (o *VirtualMachineRunCommandInstanceView) GetEndTimeAsTime() (*time.Time, error) { + if o.EndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.EndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.EndTime = &formatted +} + +func (o *VirtualMachineRunCommandInstanceView) GetStartTimeAsTime() (*time.Time, error) { + if o.StartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.StartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineRunCommandInstanceView) SetStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.StartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go new file mode 100644 index 00000000000..47ffc19c5a2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandproperties.go @@ -0,0 +1,21 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandProperties struct { + AsyncExecution *bool `json:"asyncExecution,omitempty"` + ErrorBlobManagedIdentity *RunCommandManagedIdentity `json:"errorBlobManagedIdentity,omitempty"` + ErrorBlobUri *string `json:"errorBlobUri,omitempty"` + InstanceView *VirtualMachineRunCommandInstanceView `json:"instanceView,omitempty"` + OutputBlobManagedIdentity *RunCommandManagedIdentity `json:"outputBlobManagedIdentity,omitempty"` + OutputBlobUri *string `json:"outputBlobUri,omitempty"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + ProtectedParameters *[]RunCommandInputParameter `json:"protectedParameters,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + RunAsPassword *string `json:"runAsPassword,omitempty"` + RunAsUser *string `json:"runAsUser,omitempty"` + Source *VirtualMachineRunCommandScriptSource `json:"source,omitempty"` + TimeoutInSeconds *int64 `json:"timeoutInSeconds,omitempty"` + TreatFailureAsDeploymentFailure *bool `json:"treatFailureAsDeploymentFailure,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go new file mode 100644 index 00000000000..4a68970efe5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandscriptsource.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandScriptSource struct { + CommandId *string `json:"commandId,omitempty"` + Script *string `json:"script,omitempty"` + ScriptUri *string `json:"scriptUri,omitempty"` + ScriptUriManagedIdentity *RunCommandManagedIdentity `json:"scriptUriManagedIdentity,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go new file mode 100644 index 00000000000..5bc80a68f4c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/model_virtualmachineruncommandupdate.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandUpdate struct { + Properties *VirtualMachineRunCommandProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/predicates.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/predicates.go new file mode 100644 index 00000000000..3858937cfb3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/predicates.go @@ -0,0 +1,32 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRunCommandOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineRunCommandOperationPredicate) Matches(input VirtualMachineRunCommand) 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/compute/2024-11-01/virtualmachinescalesetvmruncommands/version.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/version.go new file mode 100644 index 00000000000..97cb9153a75 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvmruncommands/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvmruncommands + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetvmruncommands/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/README.md b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/README.md new file mode 100644 index 00000000000..439549b24b2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/README.md @@ -0,0 +1,277 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinescalesetvms` Documentation + +The `virtualmachinescalesetvms` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachinescalesetvms" +``` + + +### Client Initialization + +```go +client := virtualmachinescalesetvms.NewVirtualMachineScaleSetVMsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.ApproveRollingUpgrade` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.ApproveRollingUpgradeThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.AttachDetachDataDisks` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.AttachDetachDataDisksRequest{ + // ... +} + + +if err := client.AttachDetachDataDisksThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Deallocate` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.DeallocateThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.DeleteThenPoll(ctx, id, virtualmachinescalesetvms.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.Get(ctx, id, virtualmachinescalesetvms.DefaultGetOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.GetInstanceView` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.GetInstanceView(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.List` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + +// alternatively `client.List(ctx, id, virtualmachinescalesetvms.DefaultListOperationOptions())` can be used to do batched pagination +items, err := client.ListComplete(ctx, id, virtualmachinescalesetvms.DefaultListOperationOptions()) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.PerformMaintenance` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.PerformMaintenanceThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.PowerOff` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.PowerOffThenPoll(ctx, id, virtualmachinescalesetvms.DefaultPowerOffOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Redeploy` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.RedeployThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Reimage` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.VirtualMachineScaleSetVMReimageParameters{ + // ... +} + + +if err := client.ReimageThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.ReimageAll` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.ReimageAllThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.RetrieveBootDiagnosticsData` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.RetrieveBootDiagnosticsData(ctx, id, virtualmachinescalesetvms.DefaultRetrieveBootDiagnosticsDataOperationOptions()) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.RunCommand` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.RunCommandInput{ + // ... +} + + +if err := client.RunCommandThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.SimulateEviction` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +read, err := client.SimulateEviction(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Start` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineScaleSetVMsClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinescalesetvms.NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + +payload := virtualmachinescalesetvms.VirtualMachineScaleSetVM{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload, virtualmachinescalesetvms.DefaultUpdateOperationOptions()); err != nil { + // handle the error +} +``` diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/client.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/client.go new file mode 100644 index 00000000000..61a216f26bf --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/client.go @@ -0,0 +1,26 @@ +package virtualmachinescalesetvms + +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 VirtualMachineScaleSetVMsClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineScaleSetVMsClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineScaleSetVMsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinescalesetvms", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineScaleSetVMsClient: %+v", err) + } + + return &VirtualMachineScaleSetVMsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/constants.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/constants.go new file mode 100644 index 00000000000..b1215399ff2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/constants.go @@ -0,0 +1,2176 @@ +package virtualmachinescalesetvms + +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 CachingTypes string + +const ( + CachingTypesNone CachingTypes = "None" + CachingTypesReadOnly CachingTypes = "ReadOnly" + CachingTypesReadWrite CachingTypes = "ReadWrite" +) + +func PossibleValuesForCachingTypes() []string { + return []string{ + string(CachingTypesNone), + string(CachingTypesReadOnly), + string(CachingTypesReadWrite), + } +} + +func (s *CachingTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCachingTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCachingTypes(input string) (*CachingTypes, error) { + vals := map[string]CachingTypes{ + "none": CachingTypesNone, + "readonly": CachingTypesReadOnly, + "readwrite": CachingTypesReadWrite, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CachingTypes(input) + return &out, nil +} + +type ComponentNames string + +const ( + ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup ComponentNames = "Microsoft-Windows-Shell-Setup" +) + +func PossibleValuesForComponentNames() []string { + return []string{ + string(ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup), + } +} + +func (s *ComponentNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseComponentNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseComponentNames(input string) (*ComponentNames, error) { + vals := map[string]ComponentNames{ + "microsoft-windows-shell-setup": ComponentNamesMicrosoftNegativeWindowsNegativeShellNegativeSetup, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ComponentNames(input) + return &out, nil +} + +type DeleteOptions string + +const ( + DeleteOptionsDelete DeleteOptions = "Delete" + DeleteOptionsDetach DeleteOptions = "Detach" +) + +func PossibleValuesForDeleteOptions() []string { + return []string{ + string(DeleteOptionsDelete), + string(DeleteOptionsDetach), + } +} + +func (s *DeleteOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteOptions(input string) (*DeleteOptions, error) { + vals := map[string]DeleteOptions{ + "delete": DeleteOptionsDelete, + "detach": DeleteOptionsDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteOptions(input) + return &out, nil +} + +type DiffDiskOptions string + +const ( + DiffDiskOptionsLocal DiffDiskOptions = "Local" +) + +func PossibleValuesForDiffDiskOptions() []string { + return []string{ + string(DiffDiskOptionsLocal), + } +} + +func (s *DiffDiskOptions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskOptions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskOptions(input string) (*DiffDiskOptions, error) { + vals := map[string]DiffDiskOptions{ + "local": DiffDiskOptionsLocal, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskOptions(input) + return &out, nil +} + +type DiffDiskPlacement string + +const ( + DiffDiskPlacementCacheDisk DiffDiskPlacement = "CacheDisk" + DiffDiskPlacementNVMeDisk DiffDiskPlacement = "NvmeDisk" + DiffDiskPlacementResourceDisk DiffDiskPlacement = "ResourceDisk" +) + +func PossibleValuesForDiffDiskPlacement() []string { + return []string{ + string(DiffDiskPlacementCacheDisk), + string(DiffDiskPlacementNVMeDisk), + string(DiffDiskPlacementResourceDisk), + } +} + +func (s *DiffDiskPlacement) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiffDiskPlacement(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiffDiskPlacement(input string) (*DiffDiskPlacement, error) { + vals := map[string]DiffDiskPlacement{ + "cachedisk": DiffDiskPlacementCacheDisk, + "nvmedisk": DiffDiskPlacementNVMeDisk, + "resourcedisk": DiffDiskPlacementResourceDisk, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiffDiskPlacement(input) + return &out, nil +} + +type DiskControllerTypes string + +const ( + DiskControllerTypesNVMe DiskControllerTypes = "NVMe" + DiskControllerTypesSCSI DiskControllerTypes = "SCSI" +) + +func PossibleValuesForDiskControllerTypes() []string { + return []string{ + string(DiskControllerTypesNVMe), + string(DiskControllerTypesSCSI), + } +} + +func (s *DiskControllerTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskControllerTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskControllerTypes(input string) (*DiskControllerTypes, error) { + vals := map[string]DiskControllerTypes{ + "nvme": DiskControllerTypesNVMe, + "scsi": DiskControllerTypesSCSI, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskControllerTypes(input) + return &out, nil +} + +type DiskCreateOptionTypes string + +const ( + DiskCreateOptionTypesAttach DiskCreateOptionTypes = "Attach" + DiskCreateOptionTypesCopy DiskCreateOptionTypes = "Copy" + DiskCreateOptionTypesEmpty DiskCreateOptionTypes = "Empty" + DiskCreateOptionTypesFromImage DiskCreateOptionTypes = "FromImage" + DiskCreateOptionTypesRestore DiskCreateOptionTypes = "Restore" +) + +func PossibleValuesForDiskCreateOptionTypes() []string { + return []string{ + string(DiskCreateOptionTypesAttach), + string(DiskCreateOptionTypesCopy), + string(DiskCreateOptionTypesEmpty), + string(DiskCreateOptionTypesFromImage), + string(DiskCreateOptionTypesRestore), + } +} + +func (s *DiskCreateOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskCreateOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskCreateOptionTypes(input string) (*DiskCreateOptionTypes, error) { + vals := map[string]DiskCreateOptionTypes{ + "attach": DiskCreateOptionTypesAttach, + "copy": DiskCreateOptionTypesCopy, + "empty": DiskCreateOptionTypesEmpty, + "fromimage": DiskCreateOptionTypesFromImage, + "restore": DiskCreateOptionTypesRestore, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskCreateOptionTypes(input) + return &out, nil +} + +type DiskDeleteOptionTypes string + +const ( + DiskDeleteOptionTypesDelete DiskDeleteOptionTypes = "Delete" + DiskDeleteOptionTypesDetach DiskDeleteOptionTypes = "Detach" +) + +func PossibleValuesForDiskDeleteOptionTypes() []string { + return []string{ + string(DiskDeleteOptionTypesDelete), + string(DiskDeleteOptionTypesDetach), + } +} + +func (s *DiskDeleteOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDeleteOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDeleteOptionTypes(input string) (*DiskDeleteOptionTypes, error) { + vals := map[string]DiskDeleteOptionTypes{ + "delete": DiskDeleteOptionTypesDelete, + "detach": DiskDeleteOptionTypesDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDeleteOptionTypes(input) + return &out, nil +} + +type DiskDetachOptionTypes string + +const ( + DiskDetachOptionTypesForceDetach DiskDetachOptionTypes = "ForceDetach" +) + +func PossibleValuesForDiskDetachOptionTypes() []string { + return []string{ + string(DiskDetachOptionTypesForceDetach), + } +} + +func (s *DiskDetachOptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDiskDetachOptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDiskDetachOptionTypes(input string) (*DiskDetachOptionTypes, error) { + vals := map[string]DiskDetachOptionTypes{ + "forcedetach": DiskDetachOptionTypesForceDetach, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DiskDetachOptionTypes(input) + return &out, nil +} + +type DomainNameLabelScopeTypes string + +const ( + DomainNameLabelScopeTypesNoReuse DomainNameLabelScopeTypes = "NoReuse" + DomainNameLabelScopeTypesResourceGroupReuse DomainNameLabelScopeTypes = "ResourceGroupReuse" + DomainNameLabelScopeTypesSubscriptionReuse DomainNameLabelScopeTypes = "SubscriptionReuse" + DomainNameLabelScopeTypesTenantReuse DomainNameLabelScopeTypes = "TenantReuse" +) + +func PossibleValuesForDomainNameLabelScopeTypes() []string { + return []string{ + string(DomainNameLabelScopeTypesNoReuse), + string(DomainNameLabelScopeTypesResourceGroupReuse), + string(DomainNameLabelScopeTypesSubscriptionReuse), + string(DomainNameLabelScopeTypesTenantReuse), + } +} + +func (s *DomainNameLabelScopeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDomainNameLabelScopeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDomainNameLabelScopeTypes(input string) (*DomainNameLabelScopeTypes, error) { + vals := map[string]DomainNameLabelScopeTypes{ + "noreuse": DomainNameLabelScopeTypesNoReuse, + "resourcegroupreuse": DomainNameLabelScopeTypesResourceGroupReuse, + "subscriptionreuse": DomainNameLabelScopeTypesSubscriptionReuse, + "tenantreuse": DomainNameLabelScopeTypesTenantReuse, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DomainNameLabelScopeTypes(input) + return &out, nil +} + +type HyperVGeneration string + +const ( + HyperVGenerationVOne HyperVGeneration = "V1" + HyperVGenerationVTwo HyperVGeneration = "V2" +) + +func PossibleValuesForHyperVGeneration() []string { + return []string{ + string(HyperVGenerationVOne), + string(HyperVGenerationVTwo), + } +} + +func (s *HyperVGeneration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHyperVGeneration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHyperVGeneration(input string) (*HyperVGeneration, error) { + vals := map[string]HyperVGeneration{ + "v1": HyperVGenerationVOne, + "v2": HyperVGenerationVTwo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HyperVGeneration(input) + return &out, nil +} + +type IPVersion string + +const ( + IPVersionIPvFour IPVersion = "IPv4" + IPVersionIPvSix IPVersion = "IPv6" +) + +func PossibleValuesForIPVersion() []string { + return []string{ + string(IPVersionIPvFour), + string(IPVersionIPvSix), + } +} + +func (s *IPVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersion(input string) (*IPVersion, error) { + vals := map[string]IPVersion{ + "ipv4": IPVersionIPvFour, + "ipv6": IPVersionIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersion(input) + return &out, nil +} + +type IPVersions string + +const ( + IPVersionsIPvFour IPVersions = "IPv4" + IPVersionsIPvSix IPVersions = "IPv6" +) + +func PossibleValuesForIPVersions() []string { + return []string{ + string(IPVersionsIPvFour), + string(IPVersionsIPvSix), + } +} + +func (s *IPVersions) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIPVersions(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIPVersions(input string) (*IPVersions, error) { + vals := map[string]IPVersions{ + "ipv4": IPVersionsIPvFour, + "ipv6": IPVersionsIPvSix, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IPVersions(input) + return &out, nil +} + +type InstanceViewTypes string + +const ( + InstanceViewTypesInstanceView InstanceViewTypes = "instanceView" + InstanceViewTypesResiliencyView InstanceViewTypes = "resiliencyView" + InstanceViewTypesUserData InstanceViewTypes = "userData" +) + +func PossibleValuesForInstanceViewTypes() []string { + return []string{ + string(InstanceViewTypesInstanceView), + string(InstanceViewTypesResiliencyView), + string(InstanceViewTypesUserData), + } +} + +func (s *InstanceViewTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInstanceViewTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInstanceViewTypes(input string) (*InstanceViewTypes, error) { + vals := map[string]InstanceViewTypes{ + "instanceview": InstanceViewTypesInstanceView, + "resiliencyview": InstanceViewTypesResiliencyView, + "userdata": InstanceViewTypesUserData, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InstanceViewTypes(input) + return &out, nil +} + +type LinuxPatchAssessmentMode string + +const ( + LinuxPatchAssessmentModeAutomaticByPlatform LinuxPatchAssessmentMode = "AutomaticByPlatform" + LinuxPatchAssessmentModeImageDefault LinuxPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForLinuxPatchAssessmentMode() []string { + return []string{ + string(LinuxPatchAssessmentModeAutomaticByPlatform), + string(LinuxPatchAssessmentModeImageDefault), + } +} + +func (s *LinuxPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxPatchAssessmentMode(input string) (*LinuxPatchAssessmentMode, error) { + vals := map[string]LinuxPatchAssessmentMode{ + "automaticbyplatform": LinuxPatchAssessmentModeAutomaticByPlatform, + "imagedefault": LinuxPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxPatchAssessmentMode(input) + return &out, nil +} + +type LinuxVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown LinuxVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForLinuxVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *LinuxVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*LinuxVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]LinuxVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": LinuxVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": LinuxVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": LinuxVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": LinuxVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type LinuxVMGuestPatchMode string + +const ( + LinuxVMGuestPatchModeAutomaticByPlatform LinuxVMGuestPatchMode = "AutomaticByPlatform" + LinuxVMGuestPatchModeImageDefault LinuxVMGuestPatchMode = "ImageDefault" +) + +func PossibleValuesForLinuxVMGuestPatchMode() []string { + return []string{ + string(LinuxVMGuestPatchModeAutomaticByPlatform), + string(LinuxVMGuestPatchModeImageDefault), + } +} + +func (s *LinuxVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLinuxVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLinuxVMGuestPatchMode(input string) (*LinuxVMGuestPatchMode, error) { + vals := map[string]LinuxVMGuestPatchMode{ + "automaticbyplatform": LinuxVMGuestPatchModeAutomaticByPlatform, + "imagedefault": LinuxVMGuestPatchModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LinuxVMGuestPatchMode(input) + return &out, nil +} + +type MaintenanceOperationResultCodeTypes string + +const ( + MaintenanceOperationResultCodeTypesMaintenanceAborted MaintenanceOperationResultCodeTypes = "MaintenanceAborted" + MaintenanceOperationResultCodeTypesMaintenanceCompleted MaintenanceOperationResultCodeTypes = "MaintenanceCompleted" + MaintenanceOperationResultCodeTypesNone MaintenanceOperationResultCodeTypes = "None" + MaintenanceOperationResultCodeTypesRetryLater MaintenanceOperationResultCodeTypes = "RetryLater" +) + +func PossibleValuesForMaintenanceOperationResultCodeTypes() []string { + return []string{ + string(MaintenanceOperationResultCodeTypesMaintenanceAborted), + string(MaintenanceOperationResultCodeTypesMaintenanceCompleted), + string(MaintenanceOperationResultCodeTypesNone), + string(MaintenanceOperationResultCodeTypesRetryLater), + } +} + +func (s *MaintenanceOperationResultCodeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMaintenanceOperationResultCodeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMaintenanceOperationResultCodeTypes(input string) (*MaintenanceOperationResultCodeTypes, error) { + vals := map[string]MaintenanceOperationResultCodeTypes{ + "maintenanceaborted": MaintenanceOperationResultCodeTypesMaintenanceAborted, + "maintenancecompleted": MaintenanceOperationResultCodeTypesMaintenanceCompleted, + "none": MaintenanceOperationResultCodeTypesNone, + "retrylater": MaintenanceOperationResultCodeTypesRetryLater, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := MaintenanceOperationResultCodeTypes(input) + return &out, nil +} + +type Mode string + +const ( + ModeAudit Mode = "Audit" + ModeEnforce Mode = "Enforce" +) + +func PossibleValuesForMode() []string { + return []string{ + string(ModeAudit), + string(ModeEnforce), + } +} + +func (s *Mode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseMode(input string) (*Mode, error) { + vals := map[string]Mode{ + "audit": ModeAudit, + "enforce": ModeEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Mode(input) + return &out, nil +} + +type Modes string + +const ( + ModesAudit Modes = "Audit" + ModesDisabled Modes = "Disabled" + ModesEnforce Modes = "Enforce" +) + +func PossibleValuesForModes() []string { + return []string{ + string(ModesAudit), + string(ModesDisabled), + string(ModesEnforce), + } +} + +func (s *Modes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseModes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseModes(input string) (*Modes, error) { + vals := map[string]Modes{ + "audit": ModesAudit, + "disabled": ModesDisabled, + "enforce": ModesEnforce, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Modes(input) + return &out, nil +} + +type NetworkApiVersion string + +const ( + NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne NetworkApiVersion = "2022-11-01" + NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne NetworkApiVersion = "2020-11-01" +) + +func PossibleValuesForNetworkApiVersion() []string { + return []string{ + string(NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne), + string(NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne), + } +} + +func (s *NetworkApiVersion) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkApiVersion(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkApiVersion(input string) (*NetworkApiVersion, error) { + vals := map[string]NetworkApiVersion{ + "2022-11-01": NetworkApiVersionTwoZeroTwoTwoNegativeOneOneNegativeZeroOne, + "2020-11-01": NetworkApiVersionTwoZeroTwoZeroNegativeOneOneNegativeZeroOne, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkApiVersion(input) + return &out, nil +} + +type NetworkInterfaceAuxiliaryMode string + +const ( + NetworkInterfaceAuxiliaryModeAcceleratedConnections NetworkInterfaceAuxiliaryMode = "AcceleratedConnections" + NetworkInterfaceAuxiliaryModeFloating NetworkInterfaceAuxiliaryMode = "Floating" + NetworkInterfaceAuxiliaryModeNone NetworkInterfaceAuxiliaryMode = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliaryMode() []string { + return []string{ + string(NetworkInterfaceAuxiliaryModeAcceleratedConnections), + string(NetworkInterfaceAuxiliaryModeFloating), + string(NetworkInterfaceAuxiliaryModeNone), + } +} + +func (s *NetworkInterfaceAuxiliaryMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliaryMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliaryMode(input string) (*NetworkInterfaceAuxiliaryMode, error) { + vals := map[string]NetworkInterfaceAuxiliaryMode{ + "acceleratedconnections": NetworkInterfaceAuxiliaryModeAcceleratedConnections, + "floating": NetworkInterfaceAuxiliaryModeFloating, + "none": NetworkInterfaceAuxiliaryModeNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliaryMode(input) + return &out, nil +} + +type NetworkInterfaceAuxiliarySku string + +const ( + NetworkInterfaceAuxiliarySkuAEight NetworkInterfaceAuxiliarySku = "A8" + NetworkInterfaceAuxiliarySkuAFour NetworkInterfaceAuxiliarySku = "A4" + NetworkInterfaceAuxiliarySkuAOne NetworkInterfaceAuxiliarySku = "A1" + NetworkInterfaceAuxiliarySkuATwo NetworkInterfaceAuxiliarySku = "A2" + NetworkInterfaceAuxiliarySkuNone NetworkInterfaceAuxiliarySku = "None" +) + +func PossibleValuesForNetworkInterfaceAuxiliarySku() []string { + return []string{ + string(NetworkInterfaceAuxiliarySkuAEight), + string(NetworkInterfaceAuxiliarySkuAFour), + string(NetworkInterfaceAuxiliarySkuAOne), + string(NetworkInterfaceAuxiliarySkuATwo), + string(NetworkInterfaceAuxiliarySkuNone), + } +} + +func (s *NetworkInterfaceAuxiliarySku) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseNetworkInterfaceAuxiliarySku(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseNetworkInterfaceAuxiliarySku(input string) (*NetworkInterfaceAuxiliarySku, error) { + vals := map[string]NetworkInterfaceAuxiliarySku{ + "a8": NetworkInterfaceAuxiliarySkuAEight, + "a4": NetworkInterfaceAuxiliarySkuAFour, + "a1": NetworkInterfaceAuxiliarySkuAOne, + "a2": NetworkInterfaceAuxiliarySkuATwo, + "none": NetworkInterfaceAuxiliarySkuNone, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := NetworkInterfaceAuxiliarySku(input) + return &out, nil +} + +type OperatingSystemTypes string + +const ( + OperatingSystemTypesLinux OperatingSystemTypes = "Linux" + OperatingSystemTypesWindows OperatingSystemTypes = "Windows" +) + +func PossibleValuesForOperatingSystemTypes() []string { + return []string{ + string(OperatingSystemTypesLinux), + string(OperatingSystemTypesWindows), + } +} + +func (s *OperatingSystemTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOperatingSystemTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOperatingSystemTypes(input string) (*OperatingSystemTypes, error) { + vals := map[string]OperatingSystemTypes{ + "linux": OperatingSystemTypesLinux, + "windows": OperatingSystemTypesWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OperatingSystemTypes(input) + return &out, nil +} + +type PassNames string + +const ( + PassNamesOobeSystem PassNames = "OobeSystem" +) + +func PossibleValuesForPassNames() []string { + return []string{ + string(PassNamesOobeSystem), + } +} + +func (s *PassNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePassNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePassNames(input string) (*PassNames, error) { + vals := map[string]PassNames{ + "oobesystem": PassNamesOobeSystem, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PassNames(input) + return &out, nil +} + +type ProtocolTypes string + +const ( + ProtocolTypesHTTP ProtocolTypes = "Http" + ProtocolTypesHTTPS ProtocolTypes = "Https" +) + +func PossibleValuesForProtocolTypes() []string { + return []string{ + string(ProtocolTypesHTTP), + string(ProtocolTypesHTTPS), + } +} + +func (s *ProtocolTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProtocolTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProtocolTypes(input string) (*ProtocolTypes, error) { + vals := map[string]ProtocolTypes{ + "http": ProtocolTypesHTTP, + "https": ProtocolTypesHTTPS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProtocolTypes(input) + return &out, nil +} + +type PublicIPAddressSkuName string + +const ( + PublicIPAddressSkuNameBasic PublicIPAddressSkuName = "Basic" + PublicIPAddressSkuNameStandard PublicIPAddressSkuName = "Standard" +) + +func PossibleValuesForPublicIPAddressSkuName() []string { + return []string{ + string(PublicIPAddressSkuNameBasic), + string(PublicIPAddressSkuNameStandard), + } +} + +func (s *PublicIPAddressSkuName) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuName(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuName(input string) (*PublicIPAddressSkuName, error) { + vals := map[string]PublicIPAddressSkuName{ + "basic": PublicIPAddressSkuNameBasic, + "standard": PublicIPAddressSkuNameStandard, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuName(input) + return &out, nil +} + +type PublicIPAddressSkuTier string + +const ( + PublicIPAddressSkuTierGlobal PublicIPAddressSkuTier = "Global" + PublicIPAddressSkuTierRegional PublicIPAddressSkuTier = "Regional" +) + +func PossibleValuesForPublicIPAddressSkuTier() []string { + return []string{ + string(PublicIPAddressSkuTierGlobal), + string(PublicIPAddressSkuTierRegional), + } +} + +func (s *PublicIPAddressSkuTier) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAddressSkuTier(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAddressSkuTier(input string) (*PublicIPAddressSkuTier, error) { + vals := map[string]PublicIPAddressSkuTier{ + "global": PublicIPAddressSkuTierGlobal, + "regional": PublicIPAddressSkuTierRegional, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAddressSkuTier(input) + return &out, nil +} + +type PublicIPAllocationMethod string + +const ( + PublicIPAllocationMethodDynamic PublicIPAllocationMethod = "Dynamic" + PublicIPAllocationMethodStatic PublicIPAllocationMethod = "Static" +) + +func PossibleValuesForPublicIPAllocationMethod() []string { + return []string{ + string(PublicIPAllocationMethodDynamic), + string(PublicIPAllocationMethodStatic), + } +} + +func (s *PublicIPAllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicIPAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicIPAllocationMethod(input string) (*PublicIPAllocationMethod, error) { + vals := map[string]PublicIPAllocationMethod{ + "dynamic": PublicIPAllocationMethodDynamic, + "static": PublicIPAllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicIPAllocationMethod(input) + return &out, nil +} + +type ResilientVMDeletionStatus string + +const ( + ResilientVMDeletionStatusDisabled ResilientVMDeletionStatus = "Disabled" + ResilientVMDeletionStatusEnabled ResilientVMDeletionStatus = "Enabled" + ResilientVMDeletionStatusFailed ResilientVMDeletionStatus = "Failed" + ResilientVMDeletionStatusInProgress ResilientVMDeletionStatus = "InProgress" +) + +func PossibleValuesForResilientVMDeletionStatus() []string { + return []string{ + string(ResilientVMDeletionStatusDisabled), + string(ResilientVMDeletionStatusEnabled), + string(ResilientVMDeletionStatusFailed), + string(ResilientVMDeletionStatusInProgress), + } +} + +func (s *ResilientVMDeletionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseResilientVMDeletionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseResilientVMDeletionStatus(input string) (*ResilientVMDeletionStatus, error) { + vals := map[string]ResilientVMDeletionStatus{ + "disabled": ResilientVMDeletionStatusDisabled, + "enabled": ResilientVMDeletionStatusEnabled, + "failed": ResilientVMDeletionStatusFailed, + "inprogress": ResilientVMDeletionStatusInProgress, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ResilientVMDeletionStatus(input) + return &out, nil +} + +type SecurityEncryptionTypes string + +const ( + SecurityEncryptionTypesDiskWithVMGuestState SecurityEncryptionTypes = "DiskWithVMGuestState" + SecurityEncryptionTypesNonPersistedTPM SecurityEncryptionTypes = "NonPersistedTPM" + SecurityEncryptionTypesVMGuestStateOnly SecurityEncryptionTypes = "VMGuestStateOnly" +) + +func PossibleValuesForSecurityEncryptionTypes() []string { + return []string{ + string(SecurityEncryptionTypesDiskWithVMGuestState), + string(SecurityEncryptionTypesNonPersistedTPM), + string(SecurityEncryptionTypesVMGuestStateOnly), + } +} + +func (s *SecurityEncryptionTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityEncryptionTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityEncryptionTypes(input string) (*SecurityEncryptionTypes, error) { + vals := map[string]SecurityEncryptionTypes{ + "diskwithvmgueststate": SecurityEncryptionTypesDiskWithVMGuestState, + "nonpersistedtpm": SecurityEncryptionTypesNonPersistedTPM, + "vmgueststateonly": SecurityEncryptionTypesVMGuestStateOnly, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityEncryptionTypes(input) + return &out, nil +} + +type SecurityTypes string + +const ( + SecurityTypesConfidentialVM SecurityTypes = "ConfidentialVM" + SecurityTypesTrustedLaunch SecurityTypes = "TrustedLaunch" +) + +func PossibleValuesForSecurityTypes() []string { + return []string{ + string(SecurityTypesConfidentialVM), + string(SecurityTypesTrustedLaunch), + } +} + +func (s *SecurityTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSecurityTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSecurityTypes(input string) (*SecurityTypes, error) { + vals := map[string]SecurityTypes{ + "confidentialvm": SecurityTypesConfidentialVM, + "trustedlaunch": SecurityTypesTrustedLaunch, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecurityTypes(input) + return &out, nil +} + +type SettingNames string + +const ( + SettingNamesAutoLogon SettingNames = "AutoLogon" + SettingNamesFirstLogonCommands SettingNames = "FirstLogonCommands" +) + +func PossibleValuesForSettingNames() []string { + return []string{ + string(SettingNamesAutoLogon), + string(SettingNamesFirstLogonCommands), + } +} + +func (s *SettingNames) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSettingNames(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSettingNames(input string) (*SettingNames, error) { + vals := map[string]SettingNames{ + "autologon": SettingNamesAutoLogon, + "firstlogoncommands": SettingNamesFirstLogonCommands, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SettingNames(input) + return &out, nil +} + +type StatusLevelTypes string + +const ( + StatusLevelTypesError StatusLevelTypes = "Error" + StatusLevelTypesInfo StatusLevelTypes = "Info" + StatusLevelTypesWarning StatusLevelTypes = "Warning" +) + +func PossibleValuesForStatusLevelTypes() []string { + return []string{ + string(StatusLevelTypesError), + string(StatusLevelTypesInfo), + string(StatusLevelTypesWarning), + } +} + +func (s *StatusLevelTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStatusLevelTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStatusLevelTypes(input string) (*StatusLevelTypes, error) { + vals := map[string]StatusLevelTypes{ + "error": StatusLevelTypesError, + "info": StatusLevelTypesInfo, + "warning": StatusLevelTypesWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StatusLevelTypes(input) + return &out, nil +} + +type StorageAccountTypes string + +const ( + StorageAccountTypesPremiumLRS StorageAccountTypes = "Premium_LRS" + StorageAccountTypesPremiumVTwoLRS StorageAccountTypes = "PremiumV2_LRS" + StorageAccountTypesPremiumZRS StorageAccountTypes = "Premium_ZRS" + StorageAccountTypesStandardLRS StorageAccountTypes = "Standard_LRS" + StorageAccountTypesStandardSSDLRS StorageAccountTypes = "StandardSSD_LRS" + StorageAccountTypesStandardSSDZRS StorageAccountTypes = "StandardSSD_ZRS" + StorageAccountTypesUltraSSDLRS StorageAccountTypes = "UltraSSD_LRS" +) + +func PossibleValuesForStorageAccountTypes() []string { + return []string{ + string(StorageAccountTypesPremiumLRS), + string(StorageAccountTypesPremiumVTwoLRS), + string(StorageAccountTypesPremiumZRS), + string(StorageAccountTypesStandardLRS), + string(StorageAccountTypesStandardSSDLRS), + string(StorageAccountTypesStandardSSDZRS), + string(StorageAccountTypesUltraSSDLRS), + } +} + +func (s *StorageAccountTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseStorageAccountTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseStorageAccountTypes(input string) (*StorageAccountTypes, error) { + vals := map[string]StorageAccountTypes{ + "premium_lrs": StorageAccountTypesPremiumLRS, + "premiumv2_lrs": StorageAccountTypesPremiumVTwoLRS, + "premium_zrs": StorageAccountTypesPremiumZRS, + "standard_lrs": StorageAccountTypesStandardLRS, + "standardssd_lrs": StorageAccountTypesStandardSSDLRS, + "standardssd_zrs": StorageAccountTypesStandardSSDZRS, + "ultrassd_lrs": StorageAccountTypesUltraSSDLRS, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := StorageAccountTypes(input) + return &out, nil +} + +type VirtualMachineSizeTypes string + +const ( + VirtualMachineSizeTypesBasicAFour VirtualMachineSizeTypes = "Basic_A4" + VirtualMachineSizeTypesBasicAOne VirtualMachineSizeTypes = "Basic_A1" + VirtualMachineSizeTypesBasicAThree VirtualMachineSizeTypes = "Basic_A3" + VirtualMachineSizeTypesBasicATwo VirtualMachineSizeTypes = "Basic_A2" + VirtualMachineSizeTypesBasicAZero VirtualMachineSizeTypes = "Basic_A0" + VirtualMachineSizeTypesStandardAEight VirtualMachineSizeTypes = "Standard_A8" + VirtualMachineSizeTypesStandardAEightVTwo VirtualMachineSizeTypes = "Standard_A8_v2" + VirtualMachineSizeTypesStandardAEightmVTwo VirtualMachineSizeTypes = "Standard_A8m_v2" + VirtualMachineSizeTypesStandardAFive VirtualMachineSizeTypes = "Standard_A5" + VirtualMachineSizeTypesStandardAFour VirtualMachineSizeTypes = "Standard_A4" + VirtualMachineSizeTypesStandardAFourVTwo VirtualMachineSizeTypes = "Standard_A4_v2" + VirtualMachineSizeTypesStandardAFourmVTwo VirtualMachineSizeTypes = "Standard_A4m_v2" + VirtualMachineSizeTypesStandardANine VirtualMachineSizeTypes = "Standard_A9" + VirtualMachineSizeTypesStandardAOne VirtualMachineSizeTypes = "Standard_A1" + VirtualMachineSizeTypesStandardAOneOne VirtualMachineSizeTypes = "Standard_A11" + VirtualMachineSizeTypesStandardAOneVTwo VirtualMachineSizeTypes = "Standard_A1_v2" + VirtualMachineSizeTypesStandardAOneZero VirtualMachineSizeTypes = "Standard_A10" + VirtualMachineSizeTypesStandardASeven VirtualMachineSizeTypes = "Standard_A7" + VirtualMachineSizeTypesStandardASix VirtualMachineSizeTypes = "Standard_A6" + VirtualMachineSizeTypesStandardAThree VirtualMachineSizeTypes = "Standard_A3" + VirtualMachineSizeTypesStandardATwo VirtualMachineSizeTypes = "Standard_A2" + VirtualMachineSizeTypesStandardATwoVTwo VirtualMachineSizeTypes = "Standard_A2_v2" + VirtualMachineSizeTypesStandardATwomVTwo VirtualMachineSizeTypes = "Standard_A2m_v2" + VirtualMachineSizeTypesStandardAZero VirtualMachineSizeTypes = "Standard_A0" + VirtualMachineSizeTypesStandardBEightms VirtualMachineSizeTypes = "Standard_B8ms" + VirtualMachineSizeTypesStandardBFourms VirtualMachineSizeTypes = "Standard_B4ms" + VirtualMachineSizeTypesStandardBOnems VirtualMachineSizeTypes = "Standard_B1ms" + VirtualMachineSizeTypesStandardBOnes VirtualMachineSizeTypes = "Standard_B1s" + VirtualMachineSizeTypesStandardBTwoms VirtualMachineSizeTypes = "Standard_B2ms" + VirtualMachineSizeTypesStandardBTwos VirtualMachineSizeTypes = "Standard_B2s" + VirtualMachineSizeTypesStandardDEightVThree VirtualMachineSizeTypes = "Standard_D8_v3" + VirtualMachineSizeTypesStandardDEightsVThree VirtualMachineSizeTypes = "Standard_D8s_v3" + VirtualMachineSizeTypesStandardDFiveVTwo VirtualMachineSizeTypes = "Standard_D5_v2" + VirtualMachineSizeTypesStandardDFour VirtualMachineSizeTypes = "Standard_D4" + VirtualMachineSizeTypesStandardDFourVThree VirtualMachineSizeTypes = "Standard_D4_v3" + VirtualMachineSizeTypesStandardDFourVTwo VirtualMachineSizeTypes = "Standard_D4_v2" + VirtualMachineSizeTypesStandardDFoursVThree VirtualMachineSizeTypes = "Standard_D4s_v3" + VirtualMachineSizeTypesStandardDOne VirtualMachineSizeTypes = "Standard_D1" + VirtualMachineSizeTypesStandardDOneFiveVTwo VirtualMachineSizeTypes = "Standard_D15_v2" + VirtualMachineSizeTypesStandardDOneFour VirtualMachineSizeTypes = "Standard_D14" + VirtualMachineSizeTypesStandardDOneFourVTwo VirtualMachineSizeTypes = "Standard_D14_v2" + VirtualMachineSizeTypesStandardDOneOne VirtualMachineSizeTypes = "Standard_D11" + VirtualMachineSizeTypesStandardDOneOneVTwo VirtualMachineSizeTypes = "Standard_D11_v2" + VirtualMachineSizeTypesStandardDOneSixVThree VirtualMachineSizeTypes = "Standard_D16_v3" + VirtualMachineSizeTypesStandardDOneSixsVThree VirtualMachineSizeTypes = "Standard_D16s_v3" + VirtualMachineSizeTypesStandardDOneThree VirtualMachineSizeTypes = "Standard_D13" + VirtualMachineSizeTypesStandardDOneThreeVTwo VirtualMachineSizeTypes = "Standard_D13_v2" + VirtualMachineSizeTypesStandardDOneTwo VirtualMachineSizeTypes = "Standard_D12" + VirtualMachineSizeTypesStandardDOneTwoVTwo VirtualMachineSizeTypes = "Standard_D12_v2" + VirtualMachineSizeTypesStandardDOneVTwo VirtualMachineSizeTypes = "Standard_D1_v2" + VirtualMachineSizeTypesStandardDSFiveVTwo VirtualMachineSizeTypes = "Standard_DS5_v2" + VirtualMachineSizeTypesStandardDSFour VirtualMachineSizeTypes = "Standard_DS4" + VirtualMachineSizeTypesStandardDSFourVTwo VirtualMachineSizeTypes = "Standard_DS4_v2" + VirtualMachineSizeTypesStandardDSOne VirtualMachineSizeTypes = "Standard_DS1" + VirtualMachineSizeTypesStandardDSOneFiveVTwo VirtualMachineSizeTypes = "Standard_DS15_v2" + VirtualMachineSizeTypesStandardDSOneFour VirtualMachineSizeTypes = "Standard_DS14" + VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo VirtualMachineSizeTypes = "Standard_DS14-8_v2" + VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS14-4_v2" + VirtualMachineSizeTypesStandardDSOneFourVTwo VirtualMachineSizeTypes = "Standard_DS14_v2" + VirtualMachineSizeTypesStandardDSOneOne VirtualMachineSizeTypes = "Standard_DS11" + VirtualMachineSizeTypesStandardDSOneOneVTwo VirtualMachineSizeTypes = "Standard_DS11_v2" + VirtualMachineSizeTypesStandardDSOneThree VirtualMachineSizeTypes = "Standard_DS13" + VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo VirtualMachineSizeTypes = "Standard_DS13-4_v2" + VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo VirtualMachineSizeTypes = "Standard_DS13-2_v2" + VirtualMachineSizeTypesStandardDSOneThreeVTwo VirtualMachineSizeTypes = "Standard_DS13_v2" + VirtualMachineSizeTypesStandardDSOneTwo VirtualMachineSizeTypes = "Standard_DS12" + VirtualMachineSizeTypesStandardDSOneTwoVTwo VirtualMachineSizeTypes = "Standard_DS12_v2" + VirtualMachineSizeTypesStandardDSOneVTwo VirtualMachineSizeTypes = "Standard_DS1_v2" + VirtualMachineSizeTypesStandardDSThree VirtualMachineSizeTypes = "Standard_DS3" + VirtualMachineSizeTypesStandardDSThreeVTwo VirtualMachineSizeTypes = "Standard_DS3_v2" + VirtualMachineSizeTypesStandardDSTwo VirtualMachineSizeTypes = "Standard_DS2" + VirtualMachineSizeTypesStandardDSTwoVTwo VirtualMachineSizeTypes = "Standard_DS2_v2" + VirtualMachineSizeTypesStandardDSixFourVThree VirtualMachineSizeTypes = "Standard_D64_v3" + VirtualMachineSizeTypesStandardDSixFoursVThree VirtualMachineSizeTypes = "Standard_D64s_v3" + VirtualMachineSizeTypesStandardDThree VirtualMachineSizeTypes = "Standard_D3" + VirtualMachineSizeTypesStandardDThreeTwoVThree VirtualMachineSizeTypes = "Standard_D32_v3" + VirtualMachineSizeTypesStandardDThreeTwosVThree VirtualMachineSizeTypes = "Standard_D32s_v3" + VirtualMachineSizeTypesStandardDThreeVTwo VirtualMachineSizeTypes = "Standard_D3_v2" + VirtualMachineSizeTypesStandardDTwo VirtualMachineSizeTypes = "Standard_D2" + VirtualMachineSizeTypesStandardDTwoVThree VirtualMachineSizeTypes = "Standard_D2_v3" + VirtualMachineSizeTypesStandardDTwoVTwo VirtualMachineSizeTypes = "Standard_D2_v2" + VirtualMachineSizeTypesStandardDTwosVThree VirtualMachineSizeTypes = "Standard_D2s_v3" + VirtualMachineSizeTypesStandardEEightVThree VirtualMachineSizeTypes = "Standard_E8_v3" + VirtualMachineSizeTypesStandardEEightsVThree VirtualMachineSizeTypes = "Standard_E8s_v3" + VirtualMachineSizeTypesStandardEFourVThree VirtualMachineSizeTypes = "Standard_E4_v3" + VirtualMachineSizeTypesStandardEFoursVThree VirtualMachineSizeTypes = "Standard_E4s_v3" + VirtualMachineSizeTypesStandardEOneSixVThree VirtualMachineSizeTypes = "Standard_E16_v3" + VirtualMachineSizeTypesStandardEOneSixsVThree VirtualMachineSizeTypes = "Standard_E16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree VirtualMachineSizeTypes = "Standard_E64-16s_v3" + VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree VirtualMachineSizeTypes = "Standard_E64-32s_v3" + VirtualMachineSizeTypesStandardESixFourVThree VirtualMachineSizeTypes = "Standard_E64_v3" + VirtualMachineSizeTypesStandardESixFoursVThree VirtualMachineSizeTypes = "Standard_E64s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree VirtualMachineSizeTypes = "Standard_E32-8s_v3" + VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree VirtualMachineSizeTypes = "Standard_E32-16_v3" + VirtualMachineSizeTypesStandardEThreeTwoVThree VirtualMachineSizeTypes = "Standard_E32_v3" + VirtualMachineSizeTypesStandardEThreeTwosVThree VirtualMachineSizeTypes = "Standard_E32s_v3" + VirtualMachineSizeTypesStandardETwoVThree VirtualMachineSizeTypes = "Standard_E2_v3" + VirtualMachineSizeTypesStandardETwosVThree VirtualMachineSizeTypes = "Standard_E2s_v3" + VirtualMachineSizeTypesStandardFEight VirtualMachineSizeTypes = "Standard_F8" + VirtualMachineSizeTypesStandardFEights VirtualMachineSizeTypes = "Standard_F8s" + VirtualMachineSizeTypesStandardFEightsVTwo VirtualMachineSizeTypes = "Standard_F8s_v2" + VirtualMachineSizeTypesStandardFFour VirtualMachineSizeTypes = "Standard_F4" + VirtualMachineSizeTypesStandardFFours VirtualMachineSizeTypes = "Standard_F4s" + VirtualMachineSizeTypesStandardFFoursVTwo VirtualMachineSizeTypes = "Standard_F4s_v2" + VirtualMachineSizeTypesStandardFOne VirtualMachineSizeTypes = "Standard_F1" + VirtualMachineSizeTypesStandardFOneSix VirtualMachineSizeTypes = "Standard_F16" + VirtualMachineSizeTypesStandardFOneSixs VirtualMachineSizeTypes = "Standard_F16s" + VirtualMachineSizeTypesStandardFOneSixsVTwo VirtualMachineSizeTypes = "Standard_F16s_v2" + VirtualMachineSizeTypesStandardFOnes VirtualMachineSizeTypes = "Standard_F1s" + VirtualMachineSizeTypesStandardFSevenTwosVTwo VirtualMachineSizeTypes = "Standard_F72s_v2" + VirtualMachineSizeTypesStandardFSixFoursVTwo VirtualMachineSizeTypes = "Standard_F64s_v2" + VirtualMachineSizeTypesStandardFThreeTwosVTwo VirtualMachineSizeTypes = "Standard_F32s_v2" + VirtualMachineSizeTypesStandardFTwo VirtualMachineSizeTypes = "Standard_F2" + VirtualMachineSizeTypesStandardFTwos VirtualMachineSizeTypes = "Standard_F2s" + VirtualMachineSizeTypesStandardFTwosVTwo VirtualMachineSizeTypes = "Standard_F2s_v2" + VirtualMachineSizeTypesStandardGFive VirtualMachineSizeTypes = "Standard_G5" + VirtualMachineSizeTypesStandardGFour VirtualMachineSizeTypes = "Standard_G4" + VirtualMachineSizeTypesStandardGOne VirtualMachineSizeTypes = "Standard_G1" + VirtualMachineSizeTypesStandardGSFive VirtualMachineSizeTypes = "Standard_GS5" + VirtualMachineSizeTypesStandardGSFiveNegativeEight VirtualMachineSizeTypes = "Standard_GS5-8" + VirtualMachineSizeTypesStandardGSFiveNegativeOneSix VirtualMachineSizeTypes = "Standard_GS5-16" + VirtualMachineSizeTypesStandardGSFour VirtualMachineSizeTypes = "Standard_GS4" + VirtualMachineSizeTypesStandardGSFourNegativeEight VirtualMachineSizeTypes = "Standard_GS4-8" + VirtualMachineSizeTypesStandardGSFourNegativeFour VirtualMachineSizeTypes = "Standard_GS4-4" + VirtualMachineSizeTypesStandardGSOne VirtualMachineSizeTypes = "Standard_GS1" + VirtualMachineSizeTypesStandardGSThree VirtualMachineSizeTypes = "Standard_GS3" + VirtualMachineSizeTypesStandardGSTwo VirtualMachineSizeTypes = "Standard_GS2" + VirtualMachineSizeTypesStandardGThree VirtualMachineSizeTypes = "Standard_G3" + VirtualMachineSizeTypesStandardGTwo VirtualMachineSizeTypes = "Standard_G2" + VirtualMachineSizeTypesStandardHEight VirtualMachineSizeTypes = "Standard_H8" + VirtualMachineSizeTypesStandardHEightm VirtualMachineSizeTypes = "Standard_H8m" + VirtualMachineSizeTypesStandardHOneSix VirtualMachineSizeTypes = "Standard_H16" + VirtualMachineSizeTypesStandardHOneSixm VirtualMachineSizeTypes = "Standard_H16m" + VirtualMachineSizeTypesStandardHOneSixmr VirtualMachineSizeTypes = "Standard_H16mr" + VirtualMachineSizeTypesStandardHOneSixr VirtualMachineSizeTypes = "Standard_H16r" + VirtualMachineSizeTypesStandardLEights VirtualMachineSizeTypes = "Standard_L8s" + VirtualMachineSizeTypesStandardLFours VirtualMachineSizeTypes = "Standard_L4s" + VirtualMachineSizeTypesStandardLOneSixs VirtualMachineSizeTypes = "Standard_L16s" + VirtualMachineSizeTypesStandardLThreeTwos VirtualMachineSizeTypes = "Standard_L32s" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms VirtualMachineSizeTypes = "Standard_M128-64ms" + VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M128-32ms" + VirtualMachineSizeTypesStandardMOneTwoEightms VirtualMachineSizeTypes = "Standard_M128ms" + VirtualMachineSizeTypesStandardMOneTwoEights VirtualMachineSizeTypes = "Standard_M128s" + VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms VirtualMachineSizeTypes = "Standard_M64-16ms" + VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms VirtualMachineSizeTypes = "Standard_M64-32ms" + VirtualMachineSizeTypesStandardMSixFourms VirtualMachineSizeTypes = "Standard_M64ms" + VirtualMachineSizeTypesStandardMSixFours VirtualMachineSizeTypes = "Standard_M64s" + VirtualMachineSizeTypesStandardNCOneTwo VirtualMachineSizeTypes = "Standard_NC12" + VirtualMachineSizeTypesStandardNCOneTwosVThree VirtualMachineSizeTypes = "Standard_NC12s_v3" + VirtualMachineSizeTypesStandardNCOneTwosVTwo VirtualMachineSizeTypes = "Standard_NC12s_v2" + VirtualMachineSizeTypesStandardNCSix VirtualMachineSizeTypes = "Standard_NC6" + VirtualMachineSizeTypesStandardNCSixsVThree VirtualMachineSizeTypes = "Standard_NC6s_v3" + VirtualMachineSizeTypesStandardNCSixsVTwo VirtualMachineSizeTypes = "Standard_NC6s_v2" + VirtualMachineSizeTypesStandardNCTwoFour VirtualMachineSizeTypes = "Standard_NC24" + VirtualMachineSizeTypesStandardNCTwoFourr VirtualMachineSizeTypes = "Standard_NC24r" + VirtualMachineSizeTypesStandardNCTwoFourrsVThree VirtualMachineSizeTypes = "Standard_NC24rs_v3" + VirtualMachineSizeTypesStandardNCTwoFourrsVTwo VirtualMachineSizeTypes = "Standard_NC24rs_v2" + VirtualMachineSizeTypesStandardNCTwoFoursVThree VirtualMachineSizeTypes = "Standard_NC24s_v3" + VirtualMachineSizeTypesStandardNCTwoFoursVTwo VirtualMachineSizeTypes = "Standard_NC24s_v2" + VirtualMachineSizeTypesStandardNDOneTwos VirtualMachineSizeTypes = "Standard_ND12s" + VirtualMachineSizeTypesStandardNDSixs VirtualMachineSizeTypes = "Standard_ND6s" + VirtualMachineSizeTypesStandardNDTwoFourrs VirtualMachineSizeTypes = "Standard_ND24rs" + VirtualMachineSizeTypesStandardNDTwoFours VirtualMachineSizeTypes = "Standard_ND24s" + VirtualMachineSizeTypesStandardNVOneTwo VirtualMachineSizeTypes = "Standard_NV12" + VirtualMachineSizeTypesStandardNVSix VirtualMachineSizeTypes = "Standard_NV6" + VirtualMachineSizeTypesStandardNVTwoFour VirtualMachineSizeTypes = "Standard_NV24" +) + +func PossibleValuesForVirtualMachineSizeTypes() []string { + return []string{ + string(VirtualMachineSizeTypesBasicAFour), + string(VirtualMachineSizeTypesBasicAOne), + string(VirtualMachineSizeTypesBasicAThree), + string(VirtualMachineSizeTypesBasicATwo), + string(VirtualMachineSizeTypesBasicAZero), + string(VirtualMachineSizeTypesStandardAEight), + string(VirtualMachineSizeTypesStandardAEightVTwo), + string(VirtualMachineSizeTypesStandardAEightmVTwo), + string(VirtualMachineSizeTypesStandardAFive), + string(VirtualMachineSizeTypesStandardAFour), + string(VirtualMachineSizeTypesStandardAFourVTwo), + string(VirtualMachineSizeTypesStandardAFourmVTwo), + string(VirtualMachineSizeTypesStandardANine), + string(VirtualMachineSizeTypesStandardAOne), + string(VirtualMachineSizeTypesStandardAOneOne), + string(VirtualMachineSizeTypesStandardAOneVTwo), + string(VirtualMachineSizeTypesStandardAOneZero), + string(VirtualMachineSizeTypesStandardASeven), + string(VirtualMachineSizeTypesStandardASix), + string(VirtualMachineSizeTypesStandardAThree), + string(VirtualMachineSizeTypesStandardATwo), + string(VirtualMachineSizeTypesStandardATwoVTwo), + string(VirtualMachineSizeTypesStandardATwomVTwo), + string(VirtualMachineSizeTypesStandardAZero), + string(VirtualMachineSizeTypesStandardBEightms), + string(VirtualMachineSizeTypesStandardBFourms), + string(VirtualMachineSizeTypesStandardBOnems), + string(VirtualMachineSizeTypesStandardBOnes), + string(VirtualMachineSizeTypesStandardBTwoms), + string(VirtualMachineSizeTypesStandardBTwos), + string(VirtualMachineSizeTypesStandardDEightVThree), + string(VirtualMachineSizeTypesStandardDEightsVThree), + string(VirtualMachineSizeTypesStandardDFiveVTwo), + string(VirtualMachineSizeTypesStandardDFour), + string(VirtualMachineSizeTypesStandardDFourVThree), + string(VirtualMachineSizeTypesStandardDFourVTwo), + string(VirtualMachineSizeTypesStandardDFoursVThree), + string(VirtualMachineSizeTypesStandardDOne), + string(VirtualMachineSizeTypesStandardDOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDOneFour), + string(VirtualMachineSizeTypesStandardDOneFourVTwo), + string(VirtualMachineSizeTypesStandardDOneOne), + string(VirtualMachineSizeTypesStandardDOneOneVTwo), + string(VirtualMachineSizeTypesStandardDOneSixVThree), + string(VirtualMachineSizeTypesStandardDOneSixsVThree), + string(VirtualMachineSizeTypesStandardDOneThree), + string(VirtualMachineSizeTypesStandardDOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDOneTwo), + string(VirtualMachineSizeTypesStandardDOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDOneVTwo), + string(VirtualMachineSizeTypesStandardDSFiveVTwo), + string(VirtualMachineSizeTypesStandardDSFour), + string(VirtualMachineSizeTypesStandardDSFourVTwo), + string(VirtualMachineSizeTypesStandardDSOne), + string(VirtualMachineSizeTypesStandardDSOneFiveVTwo), + string(VirtualMachineSizeTypesStandardDSOneFour), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneOne), + string(VirtualMachineSizeTypesStandardDSOneOneVTwo), + string(VirtualMachineSizeTypesStandardDSOneThree), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneThreeVTwo), + string(VirtualMachineSizeTypesStandardDSOneTwo), + string(VirtualMachineSizeTypesStandardDSOneTwoVTwo), + string(VirtualMachineSizeTypesStandardDSOneVTwo), + string(VirtualMachineSizeTypesStandardDSThree), + string(VirtualMachineSizeTypesStandardDSThreeVTwo), + string(VirtualMachineSizeTypesStandardDSTwo), + string(VirtualMachineSizeTypesStandardDSTwoVTwo), + string(VirtualMachineSizeTypesStandardDSixFourVThree), + string(VirtualMachineSizeTypesStandardDSixFoursVThree), + string(VirtualMachineSizeTypesStandardDThree), + string(VirtualMachineSizeTypesStandardDThreeTwoVThree), + string(VirtualMachineSizeTypesStandardDThreeTwosVThree), + string(VirtualMachineSizeTypesStandardDThreeVTwo), + string(VirtualMachineSizeTypesStandardDTwo), + string(VirtualMachineSizeTypesStandardDTwoVThree), + string(VirtualMachineSizeTypesStandardDTwoVTwo), + string(VirtualMachineSizeTypesStandardDTwosVThree), + string(VirtualMachineSizeTypesStandardEEightVThree), + string(VirtualMachineSizeTypesStandardEEightsVThree), + string(VirtualMachineSizeTypesStandardEFourVThree), + string(VirtualMachineSizeTypesStandardEFoursVThree), + string(VirtualMachineSizeTypesStandardEOneSixVThree), + string(VirtualMachineSizeTypesStandardEOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree), + string(VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree), + string(VirtualMachineSizeTypesStandardESixFourVThree), + string(VirtualMachineSizeTypesStandardESixFoursVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree), + string(VirtualMachineSizeTypesStandardEThreeTwoVThree), + string(VirtualMachineSizeTypesStandardEThreeTwosVThree), + string(VirtualMachineSizeTypesStandardETwoVThree), + string(VirtualMachineSizeTypesStandardETwosVThree), + string(VirtualMachineSizeTypesStandardFEight), + string(VirtualMachineSizeTypesStandardFEights), + string(VirtualMachineSizeTypesStandardFEightsVTwo), + string(VirtualMachineSizeTypesStandardFFour), + string(VirtualMachineSizeTypesStandardFFours), + string(VirtualMachineSizeTypesStandardFFoursVTwo), + string(VirtualMachineSizeTypesStandardFOne), + string(VirtualMachineSizeTypesStandardFOneSix), + string(VirtualMachineSizeTypesStandardFOneSixs), + string(VirtualMachineSizeTypesStandardFOneSixsVTwo), + string(VirtualMachineSizeTypesStandardFOnes), + string(VirtualMachineSizeTypesStandardFSevenTwosVTwo), + string(VirtualMachineSizeTypesStandardFSixFoursVTwo), + string(VirtualMachineSizeTypesStandardFThreeTwosVTwo), + string(VirtualMachineSizeTypesStandardFTwo), + string(VirtualMachineSizeTypesStandardFTwos), + string(VirtualMachineSizeTypesStandardFTwosVTwo), + string(VirtualMachineSizeTypesStandardGFive), + string(VirtualMachineSizeTypesStandardGFour), + string(VirtualMachineSizeTypesStandardGOne), + string(VirtualMachineSizeTypesStandardGSFive), + string(VirtualMachineSizeTypesStandardGSFiveNegativeEight), + string(VirtualMachineSizeTypesStandardGSFiveNegativeOneSix), + string(VirtualMachineSizeTypesStandardGSFour), + string(VirtualMachineSizeTypesStandardGSFourNegativeEight), + string(VirtualMachineSizeTypesStandardGSFourNegativeFour), + string(VirtualMachineSizeTypesStandardGSOne), + string(VirtualMachineSizeTypesStandardGSThree), + string(VirtualMachineSizeTypesStandardGSTwo), + string(VirtualMachineSizeTypesStandardGThree), + string(VirtualMachineSizeTypesStandardGTwo), + string(VirtualMachineSizeTypesStandardHEight), + string(VirtualMachineSizeTypesStandardHEightm), + string(VirtualMachineSizeTypesStandardHOneSix), + string(VirtualMachineSizeTypesStandardHOneSixm), + string(VirtualMachineSizeTypesStandardHOneSixmr), + string(VirtualMachineSizeTypesStandardHOneSixr), + string(VirtualMachineSizeTypesStandardLEights), + string(VirtualMachineSizeTypesStandardLFours), + string(VirtualMachineSizeTypesStandardLOneSixs), + string(VirtualMachineSizeTypesStandardLThreeTwos), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms), + string(VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMOneTwoEightms), + string(VirtualMachineSizeTypesStandardMOneTwoEights), + string(VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms), + string(VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms), + string(VirtualMachineSizeTypesStandardMSixFourms), + string(VirtualMachineSizeTypesStandardMSixFours), + string(VirtualMachineSizeTypesStandardNCOneTwo), + string(VirtualMachineSizeTypesStandardNCOneTwosVThree), + string(VirtualMachineSizeTypesStandardNCOneTwosVTwo), + string(VirtualMachineSizeTypesStandardNCSix), + string(VirtualMachineSizeTypesStandardNCSixsVThree), + string(VirtualMachineSizeTypesStandardNCSixsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFour), + string(VirtualMachineSizeTypesStandardNCTwoFourr), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVThree), + string(VirtualMachineSizeTypesStandardNCTwoFourrsVTwo), + string(VirtualMachineSizeTypesStandardNCTwoFoursVThree), + string(VirtualMachineSizeTypesStandardNCTwoFoursVTwo), + string(VirtualMachineSizeTypesStandardNDOneTwos), + string(VirtualMachineSizeTypesStandardNDSixs), + string(VirtualMachineSizeTypesStandardNDTwoFourrs), + string(VirtualMachineSizeTypesStandardNDTwoFours), + string(VirtualMachineSizeTypesStandardNVOneTwo), + string(VirtualMachineSizeTypesStandardNVSix), + string(VirtualMachineSizeTypesStandardNVTwoFour), + } +} + +func (s *VirtualMachineSizeTypes) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseVirtualMachineSizeTypes(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseVirtualMachineSizeTypes(input string) (*VirtualMachineSizeTypes, error) { + vals := map[string]VirtualMachineSizeTypes{ + "basic_a4": VirtualMachineSizeTypesBasicAFour, + "basic_a1": VirtualMachineSizeTypesBasicAOne, + "basic_a3": VirtualMachineSizeTypesBasicAThree, + "basic_a2": VirtualMachineSizeTypesBasicATwo, + "basic_a0": VirtualMachineSizeTypesBasicAZero, + "standard_a8": VirtualMachineSizeTypesStandardAEight, + "standard_a8_v2": VirtualMachineSizeTypesStandardAEightVTwo, + "standard_a8m_v2": VirtualMachineSizeTypesStandardAEightmVTwo, + "standard_a5": VirtualMachineSizeTypesStandardAFive, + "standard_a4": VirtualMachineSizeTypesStandardAFour, + "standard_a4_v2": VirtualMachineSizeTypesStandardAFourVTwo, + "standard_a4m_v2": VirtualMachineSizeTypesStandardAFourmVTwo, + "standard_a9": VirtualMachineSizeTypesStandardANine, + "standard_a1": VirtualMachineSizeTypesStandardAOne, + "standard_a11": VirtualMachineSizeTypesStandardAOneOne, + "standard_a1_v2": VirtualMachineSizeTypesStandardAOneVTwo, + "standard_a10": VirtualMachineSizeTypesStandardAOneZero, + "standard_a7": VirtualMachineSizeTypesStandardASeven, + "standard_a6": VirtualMachineSizeTypesStandardASix, + "standard_a3": VirtualMachineSizeTypesStandardAThree, + "standard_a2": VirtualMachineSizeTypesStandardATwo, + "standard_a2_v2": VirtualMachineSizeTypesStandardATwoVTwo, + "standard_a2m_v2": VirtualMachineSizeTypesStandardATwomVTwo, + "standard_a0": VirtualMachineSizeTypesStandardAZero, + "standard_b8ms": VirtualMachineSizeTypesStandardBEightms, + "standard_b4ms": VirtualMachineSizeTypesStandardBFourms, + "standard_b1ms": VirtualMachineSizeTypesStandardBOnems, + "standard_b1s": VirtualMachineSizeTypesStandardBOnes, + "standard_b2ms": VirtualMachineSizeTypesStandardBTwoms, + "standard_b2s": VirtualMachineSizeTypesStandardBTwos, + "standard_d8_v3": VirtualMachineSizeTypesStandardDEightVThree, + "standard_d8s_v3": VirtualMachineSizeTypesStandardDEightsVThree, + "standard_d5_v2": VirtualMachineSizeTypesStandardDFiveVTwo, + "standard_d4": VirtualMachineSizeTypesStandardDFour, + "standard_d4_v3": VirtualMachineSizeTypesStandardDFourVThree, + "standard_d4_v2": VirtualMachineSizeTypesStandardDFourVTwo, + "standard_d4s_v3": VirtualMachineSizeTypesStandardDFoursVThree, + "standard_d1": VirtualMachineSizeTypesStandardDOne, + "standard_d15_v2": VirtualMachineSizeTypesStandardDOneFiveVTwo, + "standard_d14": VirtualMachineSizeTypesStandardDOneFour, + "standard_d14_v2": VirtualMachineSizeTypesStandardDOneFourVTwo, + "standard_d11": VirtualMachineSizeTypesStandardDOneOne, + "standard_d11_v2": VirtualMachineSizeTypesStandardDOneOneVTwo, + "standard_d16_v3": VirtualMachineSizeTypesStandardDOneSixVThree, + "standard_d16s_v3": VirtualMachineSizeTypesStandardDOneSixsVThree, + "standard_d13": VirtualMachineSizeTypesStandardDOneThree, + "standard_d13_v2": VirtualMachineSizeTypesStandardDOneThreeVTwo, + "standard_d12": VirtualMachineSizeTypesStandardDOneTwo, + "standard_d12_v2": VirtualMachineSizeTypesStandardDOneTwoVTwo, + "standard_d1_v2": VirtualMachineSizeTypesStandardDOneVTwo, + "standard_ds5_v2": VirtualMachineSizeTypesStandardDSFiveVTwo, + "standard_ds4": VirtualMachineSizeTypesStandardDSFour, + "standard_ds4_v2": VirtualMachineSizeTypesStandardDSFourVTwo, + "standard_ds1": VirtualMachineSizeTypesStandardDSOne, + "standard_ds15_v2": VirtualMachineSizeTypesStandardDSOneFiveVTwo, + "standard_ds14": VirtualMachineSizeTypesStandardDSOneFour, + "standard_ds14-8_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeEightVTwo, + "standard_ds14-4_v2": VirtualMachineSizeTypesStandardDSOneFourNegativeFourVTwo, + "standard_ds14_v2": VirtualMachineSizeTypesStandardDSOneFourVTwo, + "standard_ds11": VirtualMachineSizeTypesStandardDSOneOne, + "standard_ds11_v2": VirtualMachineSizeTypesStandardDSOneOneVTwo, + "standard_ds13": VirtualMachineSizeTypesStandardDSOneThree, + "standard_ds13-4_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeFourVTwo, + "standard_ds13-2_v2": VirtualMachineSizeTypesStandardDSOneThreeNegativeTwoVTwo, + "standard_ds13_v2": VirtualMachineSizeTypesStandardDSOneThreeVTwo, + "standard_ds12": VirtualMachineSizeTypesStandardDSOneTwo, + "standard_ds12_v2": VirtualMachineSizeTypesStandardDSOneTwoVTwo, + "standard_ds1_v2": VirtualMachineSizeTypesStandardDSOneVTwo, + "standard_ds3": VirtualMachineSizeTypesStandardDSThree, + "standard_ds3_v2": VirtualMachineSizeTypesStandardDSThreeVTwo, + "standard_ds2": VirtualMachineSizeTypesStandardDSTwo, + "standard_ds2_v2": VirtualMachineSizeTypesStandardDSTwoVTwo, + "standard_d64_v3": VirtualMachineSizeTypesStandardDSixFourVThree, + "standard_d64s_v3": VirtualMachineSizeTypesStandardDSixFoursVThree, + "standard_d3": VirtualMachineSizeTypesStandardDThree, + "standard_d32_v3": VirtualMachineSizeTypesStandardDThreeTwoVThree, + "standard_d32s_v3": VirtualMachineSizeTypesStandardDThreeTwosVThree, + "standard_d3_v2": VirtualMachineSizeTypesStandardDThreeVTwo, + "standard_d2": VirtualMachineSizeTypesStandardDTwo, + "standard_d2_v3": VirtualMachineSizeTypesStandardDTwoVThree, + "standard_d2_v2": VirtualMachineSizeTypesStandardDTwoVTwo, + "standard_d2s_v3": VirtualMachineSizeTypesStandardDTwosVThree, + "standard_e8_v3": VirtualMachineSizeTypesStandardEEightVThree, + "standard_e8s_v3": VirtualMachineSizeTypesStandardEEightsVThree, + "standard_e4_v3": VirtualMachineSizeTypesStandardEFourVThree, + "standard_e4s_v3": VirtualMachineSizeTypesStandardEFoursVThree, + "standard_e16_v3": VirtualMachineSizeTypesStandardEOneSixVThree, + "standard_e16s_v3": VirtualMachineSizeTypesStandardEOneSixsVThree, + "standard_e64-16s_v3": VirtualMachineSizeTypesStandardESixFourNegativeOneSixsVThree, + "standard_e64-32s_v3": VirtualMachineSizeTypesStandardESixFourNegativeThreeTwosVThree, + "standard_e64_v3": VirtualMachineSizeTypesStandardESixFourVThree, + "standard_e64s_v3": VirtualMachineSizeTypesStandardESixFoursVThree, + "standard_e32-8s_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeEightsVThree, + "standard_e32-16_v3": VirtualMachineSizeTypesStandardEThreeTwoNegativeOneSixVThree, + "standard_e32_v3": VirtualMachineSizeTypesStandardEThreeTwoVThree, + "standard_e32s_v3": VirtualMachineSizeTypesStandardEThreeTwosVThree, + "standard_e2_v3": VirtualMachineSizeTypesStandardETwoVThree, + "standard_e2s_v3": VirtualMachineSizeTypesStandardETwosVThree, + "standard_f8": VirtualMachineSizeTypesStandardFEight, + "standard_f8s": VirtualMachineSizeTypesStandardFEights, + "standard_f8s_v2": VirtualMachineSizeTypesStandardFEightsVTwo, + "standard_f4": VirtualMachineSizeTypesStandardFFour, + "standard_f4s": VirtualMachineSizeTypesStandardFFours, + "standard_f4s_v2": VirtualMachineSizeTypesStandardFFoursVTwo, + "standard_f1": VirtualMachineSizeTypesStandardFOne, + "standard_f16": VirtualMachineSizeTypesStandardFOneSix, + "standard_f16s": VirtualMachineSizeTypesStandardFOneSixs, + "standard_f16s_v2": VirtualMachineSizeTypesStandardFOneSixsVTwo, + "standard_f1s": VirtualMachineSizeTypesStandardFOnes, + "standard_f72s_v2": VirtualMachineSizeTypesStandardFSevenTwosVTwo, + "standard_f64s_v2": VirtualMachineSizeTypesStandardFSixFoursVTwo, + "standard_f32s_v2": VirtualMachineSizeTypesStandardFThreeTwosVTwo, + "standard_f2": VirtualMachineSizeTypesStandardFTwo, + "standard_f2s": VirtualMachineSizeTypesStandardFTwos, + "standard_f2s_v2": VirtualMachineSizeTypesStandardFTwosVTwo, + "standard_g5": VirtualMachineSizeTypesStandardGFive, + "standard_g4": VirtualMachineSizeTypesStandardGFour, + "standard_g1": VirtualMachineSizeTypesStandardGOne, + "standard_gs5": VirtualMachineSizeTypesStandardGSFive, + "standard_gs5-8": VirtualMachineSizeTypesStandardGSFiveNegativeEight, + "standard_gs5-16": VirtualMachineSizeTypesStandardGSFiveNegativeOneSix, + "standard_gs4": VirtualMachineSizeTypesStandardGSFour, + "standard_gs4-8": VirtualMachineSizeTypesStandardGSFourNegativeEight, + "standard_gs4-4": VirtualMachineSizeTypesStandardGSFourNegativeFour, + "standard_gs1": VirtualMachineSizeTypesStandardGSOne, + "standard_gs3": VirtualMachineSizeTypesStandardGSThree, + "standard_gs2": VirtualMachineSizeTypesStandardGSTwo, + "standard_g3": VirtualMachineSizeTypesStandardGThree, + "standard_g2": VirtualMachineSizeTypesStandardGTwo, + "standard_h8": VirtualMachineSizeTypesStandardHEight, + "standard_h8m": VirtualMachineSizeTypesStandardHEightm, + "standard_h16": VirtualMachineSizeTypesStandardHOneSix, + "standard_h16m": VirtualMachineSizeTypesStandardHOneSixm, + "standard_h16mr": VirtualMachineSizeTypesStandardHOneSixmr, + "standard_h16r": VirtualMachineSizeTypesStandardHOneSixr, + "standard_l8s": VirtualMachineSizeTypesStandardLEights, + "standard_l4s": VirtualMachineSizeTypesStandardLFours, + "standard_l16s": VirtualMachineSizeTypesStandardLOneSixs, + "standard_l32s": VirtualMachineSizeTypesStandardLThreeTwos, + "standard_m128-64ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeSixFourms, + "standard_m128-32ms": VirtualMachineSizeTypesStandardMOneTwoEightNegativeThreeTwoms, + "standard_m128ms": VirtualMachineSizeTypesStandardMOneTwoEightms, + "standard_m128s": VirtualMachineSizeTypesStandardMOneTwoEights, + "standard_m64-16ms": VirtualMachineSizeTypesStandardMSixFourNegativeOneSixms, + "standard_m64-32ms": VirtualMachineSizeTypesStandardMSixFourNegativeThreeTwoms, + "standard_m64ms": VirtualMachineSizeTypesStandardMSixFourms, + "standard_m64s": VirtualMachineSizeTypesStandardMSixFours, + "standard_nc12": VirtualMachineSizeTypesStandardNCOneTwo, + "standard_nc12s_v3": VirtualMachineSizeTypesStandardNCOneTwosVThree, + "standard_nc12s_v2": VirtualMachineSizeTypesStandardNCOneTwosVTwo, + "standard_nc6": VirtualMachineSizeTypesStandardNCSix, + "standard_nc6s_v3": VirtualMachineSizeTypesStandardNCSixsVThree, + "standard_nc6s_v2": VirtualMachineSizeTypesStandardNCSixsVTwo, + "standard_nc24": VirtualMachineSizeTypesStandardNCTwoFour, + "standard_nc24r": VirtualMachineSizeTypesStandardNCTwoFourr, + "standard_nc24rs_v3": VirtualMachineSizeTypesStandardNCTwoFourrsVThree, + "standard_nc24rs_v2": VirtualMachineSizeTypesStandardNCTwoFourrsVTwo, + "standard_nc24s_v3": VirtualMachineSizeTypesStandardNCTwoFoursVThree, + "standard_nc24s_v2": VirtualMachineSizeTypesStandardNCTwoFoursVTwo, + "standard_nd12s": VirtualMachineSizeTypesStandardNDOneTwos, + "standard_nd6s": VirtualMachineSizeTypesStandardNDSixs, + "standard_nd24rs": VirtualMachineSizeTypesStandardNDTwoFourrs, + "standard_nd24s": VirtualMachineSizeTypesStandardNDTwoFours, + "standard_nv12": VirtualMachineSizeTypesStandardNVOneTwo, + "standard_nv6": VirtualMachineSizeTypesStandardNVSix, + "standard_nv24": VirtualMachineSizeTypesStandardNVTwoFour, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VirtualMachineSizeTypes(input) + return &out, nil +} + +type WindowsPatchAssessmentMode string + +const ( + WindowsPatchAssessmentModeAutomaticByPlatform WindowsPatchAssessmentMode = "AutomaticByPlatform" + WindowsPatchAssessmentModeImageDefault WindowsPatchAssessmentMode = "ImageDefault" +) + +func PossibleValuesForWindowsPatchAssessmentMode() []string { + return []string{ + string(WindowsPatchAssessmentModeAutomaticByPlatform), + string(WindowsPatchAssessmentModeImageDefault), + } +} + +func (s *WindowsPatchAssessmentMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsPatchAssessmentMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsPatchAssessmentMode(input string) (*WindowsPatchAssessmentMode, error) { + vals := map[string]WindowsPatchAssessmentMode{ + "automaticbyplatform": WindowsPatchAssessmentModeAutomaticByPlatform, + "imagedefault": WindowsPatchAssessmentModeImageDefault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsPatchAssessmentMode(input) + return &out, nil +} + +type WindowsVMGuestPatchAutomaticByPlatformRebootSetting string + +const ( + WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Always" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "IfRequired" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Never" + WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown WindowsVMGuestPatchAutomaticByPlatformRebootSetting = "Unknown" +) + +func PossibleValuesForWindowsVMGuestPatchAutomaticByPlatformRebootSetting() []string { + return []string{ + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever), + string(WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown), + } +} + +func (s *WindowsVMGuestPatchAutomaticByPlatformRebootSetting) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchAutomaticByPlatformRebootSetting(input string) (*WindowsVMGuestPatchAutomaticByPlatformRebootSetting, error) { + vals := map[string]WindowsVMGuestPatchAutomaticByPlatformRebootSetting{ + "always": WindowsVMGuestPatchAutomaticByPlatformRebootSettingAlways, + "ifrequired": WindowsVMGuestPatchAutomaticByPlatformRebootSettingIfRequired, + "never": WindowsVMGuestPatchAutomaticByPlatformRebootSettingNever, + "unknown": WindowsVMGuestPatchAutomaticByPlatformRebootSettingUnknown, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchAutomaticByPlatformRebootSetting(input) + return &out, nil +} + +type WindowsVMGuestPatchMode string + +const ( + WindowsVMGuestPatchModeAutomaticByOS WindowsVMGuestPatchMode = "AutomaticByOS" + WindowsVMGuestPatchModeAutomaticByPlatform WindowsVMGuestPatchMode = "AutomaticByPlatform" + WindowsVMGuestPatchModeManual WindowsVMGuestPatchMode = "Manual" +) + +func PossibleValuesForWindowsVMGuestPatchMode() []string { + return []string{ + string(WindowsVMGuestPatchModeAutomaticByOS), + string(WindowsVMGuestPatchModeAutomaticByPlatform), + string(WindowsVMGuestPatchModeManual), + } +} + +func (s *WindowsVMGuestPatchMode) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseWindowsVMGuestPatchMode(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseWindowsVMGuestPatchMode(input string) (*WindowsVMGuestPatchMode, error) { + vals := map[string]WindowsVMGuestPatchMode{ + "automaticbyos": WindowsVMGuestPatchModeAutomaticByOS, + "automaticbyplatform": WindowsVMGuestPatchModeAutomaticByPlatform, + "manual": WindowsVMGuestPatchModeManual, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := WindowsVMGuestPatchMode(input) + return &out, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go new file mode 100644 index 00000000000..4a4bde1ec78 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset.go @@ -0,0 +1,130 @@ +package virtualmachinescalesetvms + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetId{} + +// VirtualMachineScaleSetId is a struct representing the Resource ID for a Virtual Machine Scale Set +type VirtualMachineScaleSetId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string +} + +// NewVirtualMachineScaleSetID returns a new VirtualMachineScaleSetId struct +func NewVirtualMachineScaleSetID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string) VirtualMachineScaleSetId { + return VirtualMachineScaleSetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + } +} + +// ParseVirtualMachineScaleSetID parses 'input' into a VirtualMachineScaleSetId +func ParseVirtualMachineScaleSetID(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetIDInsensitively(input string) (*VirtualMachineScaleSetId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetID checks that 'input' can be parsed as a Virtual Machine Scale Set ID +func ValidateVirtualMachineScaleSetID(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 := ParseVirtualMachineScaleSetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set ID +func (id VirtualMachineScaleSetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + } + return fmt.Sprintf("Virtual Machine Scale Set (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go new file mode 100644 index 00000000000..9ca34f474f3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescaleset_test.go @@ -0,0 +1,282 @@ +package virtualmachinescalesetvms + +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 = &VirtualMachineScaleSetId{} + +func TestNewVirtualMachineScaleSetID(t *testing.T) { + id := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } +} + +func TestFormatVirtualMachineScaleSetID(t *testing.T) { + actual := NewVirtualMachineScaleSetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestParseVirtualMachineScaleSetIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Expected: &VirtualMachineScaleSetId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetId(t *testing.T) { + segments := VirtualMachineScaleSetId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetId 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/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go new file mode 100644 index 00000000000..dd2751e73ac --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine.go @@ -0,0 +1,139 @@ +package virtualmachinescalesetvms + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&VirtualMachineScaleSetVirtualMachineId{}) +} + +var _ resourceids.ResourceId = &VirtualMachineScaleSetVirtualMachineId{} + +// VirtualMachineScaleSetVirtualMachineId is a struct representing the Resource ID for a Virtual Machine Scale Set Virtual Machine +type VirtualMachineScaleSetVirtualMachineId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineScaleSetName string + InstanceId string +} + +// NewVirtualMachineScaleSetVirtualMachineID returns a new VirtualMachineScaleSetVirtualMachineId struct +func NewVirtualMachineScaleSetVirtualMachineID(subscriptionId string, resourceGroupName string, virtualMachineScaleSetName string, instanceId string) VirtualMachineScaleSetVirtualMachineId { + return VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineScaleSetName: virtualMachineScaleSetName, + InstanceId: instanceId, + } +} + +// ParseVirtualMachineScaleSetVirtualMachineID parses 'input' into a VirtualMachineScaleSetVirtualMachineId +func ParseVirtualMachineScaleSetVirtualMachineID(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseVirtualMachineScaleSetVirtualMachineIDInsensitively parses 'input' case-insensitively into a VirtualMachineScaleSetVirtualMachineId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(input string) (*VirtualMachineScaleSetVirtualMachineId, error) { + parser := resourceids.NewParserFromResourceIdType(&VirtualMachineScaleSetVirtualMachineId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := VirtualMachineScaleSetVirtualMachineId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *VirtualMachineScaleSetVirtualMachineId) 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.VirtualMachineScaleSetName, ok = input.Parsed["virtualMachineScaleSetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineScaleSetName", input) + } + + if id.InstanceId, ok = input.Parsed["instanceId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "instanceId", input) + } + + return nil +} + +// ValidateVirtualMachineScaleSetVirtualMachineID checks that 'input' can be parsed as a Virtual Machine Scale Set Virtual Machine ID +func ValidateVirtualMachineScaleSetVirtualMachineID(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 := ParseVirtualMachineScaleSetVirtualMachineID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Compute/virtualMachineScaleSets/%s/virtualMachines/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineScaleSetName, id.InstanceId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) 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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticVirtualMachineScaleSets", "virtualMachineScaleSets", "virtualMachineScaleSets"), + resourceids.UserSpecifiedSegment("virtualMachineScaleSetName", "virtualMachineScaleSetName"), + resourceids.StaticSegment("staticVirtualMachines", "virtualMachines", "virtualMachines"), + resourceids.UserSpecifiedSegment("instanceId", "instanceId"), + } +} + +// String returns a human-readable description of this Virtual Machine Scale Set Virtual Machine ID +func (id VirtualMachineScaleSetVirtualMachineId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Scale Set Name: %q", id.VirtualMachineScaleSetName), + fmt.Sprintf("Instance: %q", id.InstanceId), + } + return fmt.Sprintf("Virtual Machine Scale Set Virtual Machine (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go new file mode 100644 index 00000000000..d89744aa15b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/id_virtualmachinescalesetvirtualmachine_test.go @@ -0,0 +1,327 @@ +package virtualmachinescalesetvms + +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 = &VirtualMachineScaleSetVirtualMachineId{} + +func TestNewVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + id := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId") + + 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.VirtualMachineScaleSetName != "virtualMachineScaleSetName" { + t.Fatalf("Expected %q but got %q for Segment 'VirtualMachineScaleSetName'", id.VirtualMachineScaleSetName, "virtualMachineScaleSetName") + } + + if id.InstanceId != "instanceId" { + t.Fatalf("Expected %q but got %q for Segment 'InstanceId'", id.InstanceId, "instanceId") + } +} + +func TestFormatVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + actual := NewVirtualMachineScaleSetVirtualMachineID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineScaleSetName", "instanceId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestParseVirtualMachineScaleSetVirtualMachineIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *VirtualMachineScaleSetVirtualMachineId + }{ + { + // 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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + VirtualMachineScaleSetName: "virtualMachineScaleSetName", + InstanceId: "instanceId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/virtualMachineScaleSetName/virtualMachines/instanceId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD", + Expected: &VirtualMachineScaleSetVirtualMachineId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + VirtualMachineScaleSetName: "vIrTuAlMaChInEsCaLeSeTnAmE", + InstanceId: "iNsTaNcEiD", + }, + }, + { + // 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.cOmPuTe/vIrTuAlMaChInEsCaLeSeTs/vIrTuAlMaChInEsCaLeSeTnAmE/vIrTuAlMaChInEs/iNsTaNcEiD/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseVirtualMachineScaleSetVirtualMachineIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.VirtualMachineScaleSetName != v.Expected.VirtualMachineScaleSetName { + t.Fatalf("Expected %q but got %q for VirtualMachineScaleSetName", v.Expected.VirtualMachineScaleSetName, actual.VirtualMachineScaleSetName) + } + + if actual.InstanceId != v.Expected.InstanceId { + t.Fatalf("Expected %q but got %q for InstanceId", v.Expected.InstanceId, actual.InstanceId) + } + + } +} + +func TestSegmentsForVirtualMachineScaleSetVirtualMachineId(t *testing.T) { + segments := VirtualMachineScaleSetVirtualMachineId{}.Segments() + if len(segments) == 0 { + t.Fatalf("VirtualMachineScaleSetVirtualMachineId 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/compute/2024-11-01/virtualmachinescalesetvms/method_approverollingupgrade.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_approverollingupgrade.go new file mode 100644 index 00000000000..c79754f4ef7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_approverollingupgrade.go @@ -0,0 +1,69 @@ +package virtualmachinescalesetvms + +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 ApproveRollingUpgradeOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ApproveRollingUpgrade ... +func (c VirtualMachineScaleSetVMsClient) ApproveRollingUpgrade(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result ApproveRollingUpgradeOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/approveRollingUpgrade", 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 +} + +// ApproveRollingUpgradeThenPoll performs ApproveRollingUpgrade then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) ApproveRollingUpgradeThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.ApproveRollingUpgrade(ctx, id) + if err != nil { + return fmt.Errorf("performing ApproveRollingUpgrade: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ApproveRollingUpgrade: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go new file mode 100644 index 00000000000..019181331e3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_attachdetachdatadisks.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvms + +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 AttachDetachDataDisksOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *StorageProfile +} + +// AttachDetachDataDisks ... +func (c VirtualMachineScaleSetVMsClient) AttachDetachDataDisks(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input AttachDetachDataDisksRequest) (result AttachDetachDataDisksOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/attachDetachDataDisks", 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 +} + +// AttachDetachDataDisksThenPoll performs AttachDetachDataDisks then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) AttachDetachDataDisksThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input AttachDetachDataDisksRequest) error { + result, err := c.AttachDetachDataDisks(ctx, id, input) + if err != nil { + return fmt.Errorf("performing AttachDetachDataDisks: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after AttachDetachDataDisks: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_deallocate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_deallocate.go new file mode 100644 index 00000000000..4829c85c98a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_deallocate.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 DeallocateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Deallocate ... +func (c VirtualMachineScaleSetVMsClient) Deallocate(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result DeallocateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/deallocate", 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 +} + +// DeallocateThenPoll performs Deallocate then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) DeallocateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Deallocate(ctx, id) + if err != nil { + return fmt.Errorf("performing Deallocate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Deallocate: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_delete.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_delete.go new file mode 100644 index 00000000000..2c4fdb5bb39 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_delete.go @@ -0,0 +1,100 @@ +package virtualmachinescalesetvms + +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 { + ForceDeletion *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.ForceDeletion != nil { + out.Append("forceDeletion", fmt.Sprintf("%v", *o.ForceDeletion)) + } + return &out +} + +// Delete ... +func (c VirtualMachineScaleSetVMsClient) Delete(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + OptionsObject: options, + 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 VirtualMachineScaleSetVMsClient) DeleteThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, 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/compute/2024-11-01/virtualmachinescalesetvms/method_get.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_get.go new file mode 100644 index 00000000000..48056f0eab3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_get.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvms + +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 GetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVM +} + +type GetOperationOptions struct { + Expand *InstanceViewTypes +} + +func DefaultGetOperationOptions() GetOperationOptions { + return GetOperationOptions{} +} + +func (o GetOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o GetOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o GetOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + return &out +} + +// Get ... +func (c VirtualMachineScaleSetVMsClient) Get(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options GetOperationOptions) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSetVM + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_getinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_getinstanceview.go new file mode 100644 index 00000000000..d2e27a1295d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_getinstanceview.go @@ -0,0 +1,54 @@ +package virtualmachinescalesetvms + +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 GetInstanceViewOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVMInstanceView +} + +// GetInstanceView ... +func (c VirtualMachineScaleSetVMsClient) GetInstanceView(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result GetInstanceViewOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/instanceView", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineScaleSetVMInstanceView + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_list.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_list.go new file mode 100644 index 00000000000..bb09ed5d71a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_list.go @@ -0,0 +1,142 @@ +package virtualmachinescalesetvms + +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 *[]VirtualMachineScaleSetVM +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []VirtualMachineScaleSetVM +} + +type ListOperationOptions struct { + Expand *string + Filter *string + Select *string +} + +func DefaultListOperationOptions() ListOperationOptions { + return ListOperationOptions{} +} + +func (o ListOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o ListOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o ListOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.Expand != nil { + out.Append("$expand", fmt.Sprintf("%v", *o.Expand)) + } + if o.Filter != nil { + out.Append("$filter", fmt.Sprintf("%v", *o.Filter)) + } + if o.Select != nil { + out.Append("$select", fmt.Sprintf("%v", *o.Select)) + } + return &out +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c VirtualMachineScaleSetVMsClient) List(ctx context.Context, id VirtualMachineScaleSetId, options ListOperationOptions) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + OptionsObject: options, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/virtualMachines", 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 *[]VirtualMachineScaleSetVM `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 VirtualMachineScaleSetVMsClient) ListComplete(ctx context.Context, id VirtualMachineScaleSetId, options ListOperationOptions) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, options, VirtualMachineScaleSetVMOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineScaleSetVMsClient) ListCompleteMatchingPredicate(ctx context.Context, id VirtualMachineScaleSetId, options ListOperationOptions, predicate VirtualMachineScaleSetVMOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineScaleSetVM, 0) + + resp, err := c.List(ctx, id, options) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_performmaintenance.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_performmaintenance.go new file mode 100644 index 00000000000..ca5dce7234a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_performmaintenance.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 PerformMaintenanceOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// PerformMaintenance ... +func (c VirtualMachineScaleSetVMsClient) PerformMaintenance(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result PerformMaintenanceOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/performMaintenance", 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 +} + +// PerformMaintenanceThenPoll performs PerformMaintenance then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) PerformMaintenanceThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.PerformMaintenance(ctx, id) + if err != nil { + return fmt.Errorf("performing PerformMaintenance: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PerformMaintenance: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_poweroff.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_poweroff.go new file mode 100644 index 00000000000..cbe987a9165 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_poweroff.go @@ -0,0 +1,99 @@ +package virtualmachinescalesetvms + +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 PowerOffOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +type PowerOffOperationOptions struct { + SkipShutdown *bool +} + +func DefaultPowerOffOperationOptions() PowerOffOperationOptions { + return PowerOffOperationOptions{} +} + +func (o PowerOffOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o PowerOffOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o PowerOffOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SkipShutdown != nil { + out.Append("skipShutdown", fmt.Sprintf("%v", *o.SkipShutdown)) + } + return &out +} + +// PowerOff ... +func (c VirtualMachineScaleSetVMsClient) PowerOff(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options PowerOffOperationOptions) (result PowerOffOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/poweroff", 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 +} + +// PowerOffThenPoll performs PowerOff then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) PowerOffThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options PowerOffOperationOptions) error { + result, err := c.PowerOff(ctx, id, options) + if err != nil { + return fmt.Errorf("performing PowerOff: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after PowerOff: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_redeploy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_redeploy.go new file mode 100644 index 00000000000..2d129ba42a1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_redeploy.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 RedeployOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Redeploy ... +func (c VirtualMachineScaleSetVMsClient) Redeploy(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result RedeployOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/redeploy", 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 +} + +// RedeployThenPoll performs Redeploy then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) RedeployThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Redeploy(ctx, id) + if err != nil { + return fmt.Errorf("performing Redeploy: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Redeploy: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimage.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimage.go new file mode 100644 index 00000000000..8ea94bc4004 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimage.go @@ -0,0 +1,74 @@ +package virtualmachinescalesetvms + +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 ReimageOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Reimage ... +func (c VirtualMachineScaleSetVMsClient) Reimage(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVMReimageParameters) (result ReimageOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimage", 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 +} + +// ReimageThenPoll performs Reimage then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) ReimageThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVMReimageParameters) error { + result, err := c.Reimage(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Reimage: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Reimage: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimageall.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimageall.go new file mode 100644 index 00000000000..e09dc08aa1b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_reimageall.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 ReimageAllOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// ReimageAll ... +func (c VirtualMachineScaleSetVMsClient) ReimageAll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result ReimageAllOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/reimageall", 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 +} + +// ReimageAllThenPoll performs ReimageAll then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) ReimageAllThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.ReimageAll(ctx, id) + if err != nil { + return fmt.Errorf("performing ReimageAll: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after ReimageAll: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_restart.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_restart.go new file mode 100644 index 00000000000..3abf763049f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_restart.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 RestartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Restart ... +func (c VirtualMachineScaleSetVMsClient) Restart(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/restart", 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 +} + +// RestartThenPoll performs Restart then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) RestartThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Restart(ctx, id) + if err != nil { + return fmt.Errorf("performing Restart: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Restart: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go new file mode 100644 index 00000000000..a93248b3042 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_retrievebootdiagnosticsdata.go @@ -0,0 +1,83 @@ +package virtualmachinescalesetvms + +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 RetrieveBootDiagnosticsDataOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *RetrieveBootDiagnosticsDataResult +} + +type RetrieveBootDiagnosticsDataOperationOptions struct { + SasUriExpirationTimeInMinutes *int64 +} + +func DefaultRetrieveBootDiagnosticsDataOperationOptions() RetrieveBootDiagnosticsDataOperationOptions { + return RetrieveBootDiagnosticsDataOperationOptions{} +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o RetrieveBootDiagnosticsDataOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + if o.SasUriExpirationTimeInMinutes != nil { + out.Append("sasUriExpirationTimeInMinutes", fmt.Sprintf("%v", *o.SasUriExpirationTimeInMinutes)) + } + return &out +} + +// RetrieveBootDiagnosticsData ... +func (c VirtualMachineScaleSetVMsClient) RetrieveBootDiagnosticsData(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, options RetrieveBootDiagnosticsDataOperationOptions) (result RetrieveBootDiagnosticsDataOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + OptionsObject: options, + Path: fmt.Sprintf("%s/retrieveBootDiagnosticsData", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model RetrieveBootDiagnosticsDataResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_runcommand.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_runcommand.go new file mode 100644 index 00000000000..909ab91e4b2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_runcommand.go @@ -0,0 +1,75 @@ +package virtualmachinescalesetvms + +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 RunCommandOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *RunCommandResult +} + +// RunCommand ... +func (c VirtualMachineScaleSetVMsClient) RunCommand(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input RunCommandInput) (result RunCommandOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/runCommand", 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 +} + +// RunCommandThenPoll performs RunCommand then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) RunCommandThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input RunCommandInput) error { + result, err := c.RunCommand(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RunCommand: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RunCommand: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_simulateeviction.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_simulateeviction.go new file mode 100644 index 00000000000..f5099b02f8f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_simulateeviction.go @@ -0,0 +1,47 @@ +package virtualmachinescalesetvms + +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 SimulateEvictionOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// SimulateEviction ... +func (c VirtualMachineScaleSetVMsClient) SimulateEviction(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result SimulateEvictionOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/simulateEviction", 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 + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_start.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_start.go new file mode 100644 index 00000000000..f7181a07733 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_start.go @@ -0,0 +1,70 @@ +package virtualmachinescalesetvms + +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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachineScaleSetVMsClient) Start(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/start", 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 +} + +// StartThenPoll performs Start then polls until it's completed +func (c VirtualMachineScaleSetVMsClient) StartThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId) error { + result, err := c.Start(ctx, id) + if err != nil { + return fmt.Errorf("performing Start: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Start: %+v", err) + } + + return nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_update.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_update.go new file mode 100644 index 00000000000..e08fda7ace4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/method_update.go @@ -0,0 +1,108 @@ +package virtualmachinescalesetvms + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *VirtualMachineScaleSetVM +} + +type UpdateOperationOptions struct { + IfMatch *string + IfNoneMatch *string +} + +func DefaultUpdateOperationOptions() UpdateOperationOptions { + return UpdateOperationOptions{} +} + +func (o UpdateOperationOptions) ToHeaders() *client.Headers { + out := client.Headers{} + if o.IfMatch != nil { + out.Append("If-Match", fmt.Sprintf("%v", *o.IfMatch)) + } + if o.IfNoneMatch != nil { + out.Append("If-None-Match", fmt.Sprintf("%v", *o.IfNoneMatch)) + } + return &out +} + +func (o UpdateOperationOptions) ToOData() *odata.Query { + out := odata.Query{} + + return &out +} + +func (o UpdateOperationOptions) ToQuery() *client.QueryParams { + out := client.QueryParams{} + + return &out +} + +// Update ... +func (c VirtualMachineScaleSetVMsClient) Update(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVM, options UpdateOperationOptions) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + OptionsObject: options, + 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 VirtualMachineScaleSetVMsClient) UpdateThenPoll(ctx context.Context, id VirtualMachineScaleSetVirtualMachineId, input VirtualMachineScaleSetVM, options UpdateOperationOptions) error { + result, err := c.Update(ctx, id, input, options) + 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/compute/2024-11-01/virtualmachinescalesetvms/model_additionalcapabilities.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalcapabilities.go new file mode 100644 index 00000000000..170432c7bfe --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalcapabilities.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalCapabilities struct { + HibernationEnabled *bool `json:"hibernationEnabled,omitempty"` + UltraSSDEnabled *bool `json:"ultraSSDEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalunattendcontent.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalunattendcontent.go new file mode 100644 index 00000000000..d1d37f7ceb4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_additionalunattendcontent.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AdditionalUnattendContent struct { + ComponentName *ComponentNames `json:"componentName,omitempty"` + Content *string `json:"content,omitempty"` + PassName *PassNames `json:"passName,omitempty"` + SettingName *SettingNames `json:"settingName,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_apientityreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_apientityreference.go new file mode 100644 index 00000000000..83c85311d72 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_apientityreference.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ApiEntityReference struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go new file mode 100644 index 00000000000..9b561c4f1d1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_attachdetachdatadisksrequest.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AttachDetachDataDisksRequest struct { + DataDisksToAttach *[]DataDisksToAttach `json:"dataDisksToAttach,omitempty"` + DataDisksToDetach *[]DataDisksToDetach `json:"dataDisksToDetach,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnostics.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnostics.go new file mode 100644 index 00000000000..1c1457f479b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnostics.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnostics struct { + Enabled *bool `json:"enabled,omitempty"` + StorageUri *string `json:"storageUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go new file mode 100644 index 00000000000..627078c9cc9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_bootdiagnosticsinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type BootDiagnosticsInstanceView struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadisk.go new file mode 100644 index 00000000000..074ea20b167 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadisk.go @@ -0,0 +1,22 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskIOPSReadWrite *int64 `json:"diskIOPSReadWrite,omitempty"` + DiskMBpsReadWrite *int64 `json:"diskMBpsReadWrite,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + Lun int64 `json:"lun"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + SourceResource *ApiEntityReference `json:"sourceResource,omitempty"` + ToBeDetached *bool `json:"toBeDetached,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstoattach.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstoattach.go new file mode 100644 index 00000000000..35fdfa1e437 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstoattach.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToAttach struct { + Caching *CachingTypes `json:"caching,omitempty"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + DiskId string `json:"diskId"` + Lun *int64 `json:"lun,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstodetach.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstodetach.go new file mode 100644 index 00000000000..d283d93ab0c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_datadiskstodetach.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DataDisksToDetach struct { + DetachOption *DiskDetachOptionTypes `json:"detachOption,omitempty"` + DiskId string `json:"diskId"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diagnosticsprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diagnosticsprofile.go new file mode 100644 index 00000000000..c7a95be33d0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diagnosticsprofile.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiagnosticsProfile struct { + BootDiagnostics *BootDiagnostics `json:"bootDiagnostics,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diffdisksettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diffdisksettings.go new file mode 100644 index 00000000000..a80fc6b1d1c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diffdisksettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiffDiskSettings struct { + Option *DiffDiskOptions `json:"option,omitempty"` + Placement *DiffDiskPlacement `json:"placement,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskencryptionsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskencryptionsettings.go new file mode 100644 index 00000000000..30f62f12488 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskencryptionsettings.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskEncryptionSettings struct { + DiskEncryptionKey *KeyVaultSecretReference `json:"diskEncryptionKey,omitempty"` + Enabled *bool `json:"enabled,omitempty"` + KeyEncryptionKey *KeyVaultKeyReference `json:"keyEncryptionKey,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskinstanceview.go new file mode 100644 index 00000000000..efb5f5ed94a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_diskinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type DiskInstanceView struct { + EncryptionSettings *[]DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_encryptionidentity.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_encryptionidentity.go new file mode 100644 index 00000000000..5371893ebbe --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_encryptionidentity.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// 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 { + UserAssignedIdentityResourceId *string `json:"userAssignedIdentityResourceId,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hardwareprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hardwareprofile.go new file mode 100644 index 00000000000..36b7827df42 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hardwareprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfile struct { + VMSize *VirtualMachineSizeTypes `json:"vmSize,omitempty"` + VMSizeProperties *VMSizeProperties `json:"vmSizeProperties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hostendpointsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hostendpointsettings.go new file mode 100644 index 00000000000..eee18be4ae6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_hostendpointsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HostEndpointSettings struct { + InVMAccessControlProfileReferenceId *string `json:"inVMAccessControlProfileReferenceId,omitempty"` + Mode *Modes `json:"mode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_imagereference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_imagereference.go new file mode 100644 index 00000000000..9e8a7c31109 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_imagereference.go @@ -0,0 +1,15 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ImageReference struct { + CommunityGalleryImageId *string `json:"communityGalleryImageId,omitempty"` + ExactVersion *string `json:"exactVersion,omitempty"` + Id *string `json:"id,omitempty"` + Offer *string `json:"offer,omitempty"` + Publisher *string `json:"publisher,omitempty"` + SharedGalleryImageId *string `json:"sharedGalleryImageId,omitempty"` + Sku *string `json:"sku,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_instanceviewstatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_instanceviewstatus.go new file mode 100644 index 00000000000..e23c59c9420 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_instanceviewstatus.go @@ -0,0 +1,30 @@ +package virtualmachinescalesetvms + +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 InstanceViewStatus struct { + Code *string `json:"code,omitempty"` + DisplayStatus *string `json:"displayStatus,omitempty"` + Level *StatusLevelTypes `json:"level,omitempty"` + Message *string `json:"message,omitempty"` + Time *string `json:"time,omitempty"` +} + +func (o *InstanceViewStatus) GetTimeAsTime() (*time.Time, error) { + if o.Time == nil { + return nil, nil + } + return dates.ParseAsFormat(o.Time, "2006-01-02T15:04:05Z07:00") +} + +func (o *InstanceViewStatus) SetTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.Time = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go new file mode 100644 index 00000000000..641c4d6cecc --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultkeyreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultKeyReference struct { + KeyURL string `json:"keyUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go new file mode 100644 index 00000000000..102c8c99c7f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_keyvaultsecretreference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type KeyVaultSecretReference struct { + SecretURL string `json:"secretUrl"` + SourceVault SubResource `json:"sourceVault"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxconfiguration.go new file mode 100644 index 00000000000..b42a4e859db --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxconfiguration.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxConfiguration struct { + DisablePasswordAuthentication *bool `json:"disablePasswordAuthentication,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *LinuxPatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + Ssh *SshConfiguration `json:"ssh,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxpatchsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxpatchsettings.go new file mode 100644 index 00000000000..f9e09edf6aa --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxpatchsettings.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxPatchSettings struct { + AssessmentMode *LinuxPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *LinuxVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + PatchMode *LinuxVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..7e71a925499 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_linuxvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinuxVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *LinuxVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go new file mode 100644 index 00000000000..3bd82eab939 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_maintenanceredeploystatus.go @@ -0,0 +1,68 @@ +package virtualmachinescalesetvms + +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 MaintenanceRedeployStatus struct { + IsCustomerInitiatedMaintenanceAllowed *bool `json:"isCustomerInitiatedMaintenanceAllowed,omitempty"` + LastOperationMessage *string `json:"lastOperationMessage,omitempty"` + LastOperationResultCode *MaintenanceOperationResultCodeTypes `json:"lastOperationResultCode,omitempty"` + MaintenanceWindowEndTime *string `json:"maintenanceWindowEndTime,omitempty"` + MaintenanceWindowStartTime *string `json:"maintenanceWindowStartTime,omitempty"` + PreMaintenanceWindowEndTime *string `json:"preMaintenanceWindowEndTime,omitempty"` + PreMaintenanceWindowStartTime *string `json:"preMaintenanceWindowStartTime,omitempty"` +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.MaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.MaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.MaintenanceWindowStartTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowEndTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowEndTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowEndTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowEndTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowEndTime = &formatted +} + +func (o *MaintenanceRedeployStatus) GetPreMaintenanceWindowStartTimeAsTime() (*time.Time, error) { + if o.PreMaintenanceWindowStartTime == nil { + return nil, nil + } + return dates.ParseAsFormat(o.PreMaintenanceWindowStartTime, "2006-01-02T15:04:05Z07:00") +} + +func (o *MaintenanceRedeployStatus) SetPreMaintenanceWindowStartTimeAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.PreMaintenanceWindowStartTime = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_manageddiskparameters.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_manageddiskparameters.go new file mode 100644 index 00000000000..0a2e47fead5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_manageddiskparameters.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ManagedDiskParameters struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + Id *string `json:"id,omitempty"` + SecurityProfile *VMDiskSecurityProfile `json:"securityProfile,omitempty"` + StorageAccountType *StorageAccountTypes `json:"storageAccountType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereference.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereference.go new file mode 100644 index 00000000000..dd4f67b9365 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereference.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReference struct { + Id *string `json:"id,omitempty"` + Properties *NetworkInterfaceReferenceProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go new file mode 100644 index 00000000000..a01e731baf3 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkinterfacereferenceproperties.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceReferenceProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkprofile.go new file mode 100644 index 00000000000..9bef9b0b18a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_networkprofile.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfile struct { + NetworkApiVersion *NetworkApiVersion `json:"networkApiVersion,omitempty"` + NetworkInterfaceConfigurations *[]VirtualMachineNetworkInterfaceConfiguration `json:"networkInterfaceConfigurations,omitempty"` + NetworkInterfaces *[]NetworkInterfaceReference `json:"networkInterfaces,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osdisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osdisk.go new file mode 100644 index 00000000000..273c553709f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osdisk.go @@ -0,0 +1,19 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSDisk struct { + Caching *CachingTypes `json:"caching,omitempty"` + CreateOption DiskCreateOptionTypes `json:"createOption"` + DeleteOption *DiskDeleteOptionTypes `json:"deleteOption,omitempty"` + DiffDiskSettings *DiffDiskSettings `json:"diffDiskSettings,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + EncryptionSettings *DiskEncryptionSettings `json:"encryptionSettings,omitempty"` + Image *VirtualHardDisk `json:"image,omitempty"` + ManagedDisk *ManagedDiskParameters `json:"managedDisk,omitempty"` + Name *string `json:"name,omitempty"` + OsType *OperatingSystemTypes `json:"osType,omitempty"` + Vhd *VirtualHardDisk `json:"vhd,omitempty"` + WriteAcceleratorEnabled *bool `json:"writeAcceleratorEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofile.go new file mode 100644 index 00000000000..a32e556050e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofile.go @@ -0,0 +1,16 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfile struct { + AdminPassword *string `json:"adminPassword,omitempty"` + AdminUsername *string `json:"adminUsername,omitempty"` + AllowExtensionOperations *bool `json:"allowExtensionOperations,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + CustomData *string `json:"customData,omitempty"` + LinuxConfiguration *LinuxConfiguration `json:"linuxConfiguration,omitempty"` + RequireGuestProvisionSignal *bool `json:"requireGuestProvisionSignal,omitempty"` + Secrets *[]VaultSecretGroup `json:"secrets,omitempty"` + WindowsConfiguration *WindowsConfiguration `json:"windowsConfiguration,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go new file mode 100644 index 00000000000..d6c035d4d02 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_osprofileprovisioningdata.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OSProfileProvisioningData struct { + AdminPassword *string `json:"adminPassword,omitempty"` + CustomData *string `json:"customData,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_patchsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_patchsettings.go new file mode 100644 index 00000000000..c9a3f5ddcff --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_patchsettings.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PatchSettings struct { + AssessmentMode *WindowsPatchAssessmentMode `json:"assessmentMode,omitempty"` + AutomaticByPlatformSettings *WindowsVMGuestPatchAutomaticByPlatformSettings `json:"automaticByPlatformSettings,omitempty"` + EnableHotpatching *bool `json:"enableHotpatching,omitempty"` + PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_plan.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_plan.go new file mode 100644 index 00000000000..f39cc115a50 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_plan.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Plan struct { + Name *string `json:"name,omitempty"` + Product *string `json:"product,omitempty"` + PromotionCode *string `json:"promotionCode,omitempty"` + Publisher *string `json:"publisher,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_proxyagentsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_proxyagentsettings.go new file mode 100644 index 00000000000..c67c507ce16 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_proxyagentsettings.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProxyAgentSettings struct { + Enabled *bool `json:"enabled,omitempty"` + Imds *HostEndpointSettings `json:"imds,omitempty"` + KeyIncarnationId *int64 `json:"keyIncarnationId,omitempty"` + Mode *Mode `json:"mode,omitempty"` + WireServer *HostEndpointSettings `json:"wireServer,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_publicipaddresssku.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_publicipaddresssku.go new file mode 100644 index 00000000000..9638bdf2343 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_publicipaddresssku.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PublicIPAddressSku struct { + Name *PublicIPAddressSkuName `json:"name,omitempty"` + Tier *PublicIPAddressSkuTier `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go new file mode 100644 index 00000000000..16155960aa8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_retrievebootdiagnosticsdataresult.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RetrieveBootDiagnosticsDataResult struct { + ConsoleScreenshotBlobUri *string `json:"consoleScreenshotBlobUri,omitempty"` + SerialConsoleLogBlobUri *string `json:"serialConsoleLogBlobUri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinput.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinput.go new file mode 100644 index 00000000000..aff992d6555 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinput.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInput struct { + CommandId string `json:"commandId"` + Parameters *[]RunCommandInputParameter `json:"parameters,omitempty"` + Script *[]string `json:"script,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinputparameter.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinputparameter.go new file mode 100644 index 00000000000..765f694dad8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandinputparameter.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandInputParameter struct { + Name string `json:"name"` + Value string `json:"value"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandresult.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandresult.go new file mode 100644 index 00000000000..3257f1d24ea --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_runcommandresult.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type RunCommandResult struct { + Value *[]InstanceViewStatus `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_securityprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_securityprofile.go new file mode 100644 index 00000000000..98ecfc14bae --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_securityprofile.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecurityProfile struct { + EncryptionAtHost *bool `json:"encryptionAtHost,omitempty"` + EncryptionIdentity *EncryptionIdentity `json:"encryptionIdentity,omitempty"` + ProxyAgentSettings *ProxyAgentSettings `json:"proxyAgentSettings,omitempty"` + SecurityType *SecurityTypes `json:"securityType,omitempty"` + UefiSettings *UefiSettings `json:"uefiSettings,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sku.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sku.go new file mode 100644 index 00000000000..56ffeb02351 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sku.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Sku struct { + Capacity *int64 `json:"capacity,omitempty"` + Name *string `json:"name,omitempty"` + Tier *string `json:"tier,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshconfiguration.go new file mode 100644 index 00000000000..ad663dc27a5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshConfiguration struct { + PublicKeys *[]SshPublicKey `json:"publicKeys,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshpublickey.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshpublickey.go new file mode 100644 index 00000000000..a12747a16a1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_sshpublickey.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SshPublicKey struct { + KeyData *string `json:"keyData,omitempty"` + Path *string `json:"path,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_storageprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_storageprofile.go new file mode 100644 index 00000000000..d6a13bd454b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_storageprofile.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfile struct { + AlignRegionalDisksToVMZone *bool `json:"alignRegionalDisksToVMZone,omitempty"` + DataDisks *[]DataDisk `json:"dataDisks,omitempty"` + DiskControllerType *DiskControllerTypes `json:"diskControllerType,omitempty"` + ImageReference *ImageReference `json:"imageReference,omitempty"` + OsDisk *OSDisk `json:"osDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_subresource.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_subresource.go new file mode 100644 index 00000000000..f4b0318fae2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_subresource.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SubResource struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_uefisettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_uefisettings.go new file mode 100644 index 00000000000..8ccb5e8b347 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_uefisettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UefiSettings struct { + SecureBootEnabled *bool `json:"secureBootEnabled,omitempty"` + VTpmEnabled *bool `json:"vTpmEnabled,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultcertificate.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultcertificate.go new file mode 100644 index 00000000000..2ed3161f67c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultcertificate.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultCertificate struct { + CertificateStore *string `json:"certificateStore,omitempty"` + CertificateURL *string `json:"certificateUrl,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultsecretgroup.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultsecretgroup.go new file mode 100644 index 00000000000..3bf566e1cd9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vaultsecretgroup.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VaultSecretGroup struct { + SourceVault *SubResource `json:"sourceVault,omitempty"` + VaultCertificates *[]VaultCertificate `json:"vaultCertificates,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualharddisk.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualharddisk.go new file mode 100644 index 00000000000..19ee527a834 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualharddisk.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualHardDisk struct { + Uri *string `json:"uri,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go new file mode 100644 index 00000000000..ed66c1c262a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineagentinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineAgentInstanceView struct { + ExtensionHandlers *[]VirtualMachineExtensionHandlerInstanceView `json:"extensionHandlers,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgentVersion *string `json:"vmAgentVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextension.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextension.go new file mode 100644 index 00000000000..c54c68745f7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextension.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtension struct { + Id *string `json:"id,omitempty"` + Location *string `json:"location,omitempty"` + Name *string `json:"name,omitempty"` + Properties *VirtualMachineExtensionProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go new file mode 100644 index 00000000000..a93b7688695 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionhandlerinstanceview.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionHandlerInstanceView struct { + Status *InstanceViewStatus `json:"status,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go new file mode 100644 index 00000000000..29c45a23015 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensioninstanceview.go @@ -0,0 +1,12 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionInstanceView struct { + Name *string `json:"name,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + Substatuses *[]InstanceViewStatus `json:"substatuses,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go new file mode 100644 index 00000000000..1e775fc8f7c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineextensionproperties.go @@ -0,0 +1,20 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineExtensionProperties struct { + AutoUpgradeMinorVersion *bool `json:"autoUpgradeMinorVersion,omitempty"` + EnableAutomaticUpgrade *bool `json:"enableAutomaticUpgrade,omitempty"` + ForceUpdateTag *string `json:"forceUpdateTag,omitempty"` + InstanceView *VirtualMachineExtensionInstanceView `json:"instanceView,omitempty"` + ProtectedSettings *interface{} `json:"protectedSettings,omitempty"` + ProtectedSettingsFromKeyVault *KeyVaultSecretReference `json:"protectedSettingsFromKeyVault,omitempty"` + ProvisionAfterExtensions *[]string `json:"provisionAfterExtensions,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Publisher *string `json:"publisher,omitempty"` + Settings *interface{} `json:"settings,omitempty"` + SuppressFailures *bool `json:"suppressFailures,omitempty"` + Type *string `json:"type,omitempty"` + TypeHandlerVersion *string `json:"typeHandlerVersion,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go new file mode 100644 index 00000000000..0d02495ead9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinehealthstatus.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineHealthStatus struct { + Status *InstanceViewStatus `json:"status,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineiptag.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineiptag.go new file mode 100644 index 00000000000..92f99c38f79 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachineiptag.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go new file mode 100644 index 00000000000..3b3f92ac0c6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go new file mode 100644 index 00000000000..38d20fa62c8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceconfigurationproperties.go @@ -0,0 +1,19 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineNetworkInterfaceDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + DscpConfiguration *SubResource `json:"dscpConfiguration,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineNetworkInterfaceIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go new file mode 100644 index 00000000000..10e54ac9a50 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfacednssettingsconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceDnsSettingsConfiguration struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go new file mode 100644 index 00000000000..ffe7773f136 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineNetworkInterfaceIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go new file mode 100644 index 00000000000..8a4ccd9b07e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinenetworkinterfaceipconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineNetworkInterfaceIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersions `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachinePublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *SubResource `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go new file mode 100644 index 00000000000..de106359d3d --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachinePublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..668109748fc --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressconfigurationproperties.go @@ -0,0 +1,14 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachinePublicIPAddressDnsSettingsConfiguration `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersions `json:"publicIPAddressVersion,omitempty"` + PublicIPAllocationMethod *PublicIPAllocationMethod `json:"publicIPAllocationMethod,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go new file mode 100644 index 00000000000..18a20a7ae89 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinepublicipaddressdnssettingsconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachinePublicIPAddressDnsSettingsConfiguration struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go new file mode 100644 index 00000000000..84c3d9ad8c0 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetIPConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go new file mode 100644 index 00000000000..55274c9b4c4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetipconfigurationproperties.go @@ -0,0 +1,15 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPConfigurationProperties struct { + ApplicationGatewayBackendAddressPools *[]SubResource `json:"applicationGatewayBackendAddressPools,omitempty"` + ApplicationSecurityGroups *[]SubResource `json:"applicationSecurityGroups,omitempty"` + LoadBalancerBackendAddressPools *[]SubResource `json:"loadBalancerBackendAddressPools,omitempty"` + LoadBalancerInboundNatPools *[]SubResource `json:"loadBalancerInboundNatPools,omitempty"` + Primary *bool `json:"primary,omitempty"` + PrivateIPAddressVersion *IPVersion `json:"privateIPAddressVersion,omitempty"` + PublicIPAddressConfiguration *VirtualMachineScaleSetPublicIPAddressConfiguration `json:"publicIPAddressConfiguration,omitempty"` + Subnet *ApiEntityReference `json:"subnet,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go new file mode 100644 index 00000000000..964b748cbde --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetiptag.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetIPTag struct { + IPTagType *string `json:"ipTagType,omitempty"` + Tag *string `json:"tag,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go new file mode 100644 index 00000000000..ea97ca5a73b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfiguration.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetNetworkConfigurationProperties `json:"properties,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go new file mode 100644 index 00000000000..18ed5c06142 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationdnssettings.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationDnsSettings struct { + DnsServers *[]string `json:"dnsServers,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go new file mode 100644 index 00000000000..a4ed65755c4 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetnetworkconfigurationproperties.go @@ -0,0 +1,18 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetNetworkConfigurationProperties struct { + AuxiliaryMode *NetworkInterfaceAuxiliaryMode `json:"auxiliaryMode,omitempty"` + AuxiliarySku *NetworkInterfaceAuxiliarySku `json:"auxiliarySku,omitempty"` + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DisableTcpStateTracking *bool `json:"disableTcpStateTracking,omitempty"` + DnsSettings *VirtualMachineScaleSetNetworkConfigurationDnsSettings `json:"dnsSettings,omitempty"` + EnableAcceleratedNetworking *bool `json:"enableAcceleratedNetworking,omitempty"` + EnableFpga *bool `json:"enableFpga,omitempty"` + EnableIPForwarding *bool `json:"enableIPForwarding,omitempty"` + IPConfigurations []VirtualMachineScaleSetIPConfiguration `json:"ipConfigurations"` + NetworkSecurityGroup *SubResource `json:"networkSecurityGroup,omitempty"` + Primary *bool `json:"primary,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go new file mode 100644 index 00000000000..fafae14ddc1 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfiguration.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfiguration struct { + Name string `json:"name"` + Properties *VirtualMachineScaleSetPublicIPAddressConfigurationProperties `json:"properties,omitempty"` + Sku *PublicIPAddressSku `json:"sku,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go new file mode 100644 index 00000000000..850e2fe1b82 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationdnssettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings struct { + DomainNameLabel string `json:"domainNameLabel"` + DomainNameLabelScope *DomainNameLabelScopeTypes `json:"domainNameLabelScope,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go new file mode 100644 index 00000000000..71fb301655f --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetpublicipaddressconfigurationproperties.go @@ -0,0 +1,13 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetPublicIPAddressConfigurationProperties struct { + DeleteOption *DeleteOptions `json:"deleteOption,omitempty"` + DnsSettings *VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings `json:"dnsSettings,omitempty"` + IPTags *[]VirtualMachineScaleSetIPTag `json:"ipTags,omitempty"` + IdleTimeoutInMinutes *int64 `json:"idleTimeoutInMinutes,omitempty"` + PublicIPAddressVersion *IPVersion `json:"publicIPAddressVersion,omitempty"` + PublicIPPrefix *SubResource `json:"publicIPPrefix,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go new file mode 100644 index 00000000000..150d34d5af2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvm.go @@ -0,0 +1,25 @@ +package virtualmachinescalesetvms + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/identity" + "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 VirtualMachineScaleSetVM struct { + Etag *string `json:"etag,omitempty"` + Id *string `json:"id,omitempty"` + Identity *identity.SystemAndUserAssignedMap `json:"identity,omitempty"` + InstanceId *string `json:"instanceId,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Plan *Plan `json:"plan,omitempty"` + Properties *VirtualMachineScaleSetVMProperties `json:"properties,omitempty"` + Resources *[]VirtualMachineExtension `json:"resources,omitempty"` + Sku *Sku `json:"sku,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` + Zones *zones.Schema `json:"zones,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go new file mode 100644 index 00000000000..541bc2d91a6 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvminstanceview.go @@ -0,0 +1,23 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMInstanceView struct { + AssignedHost *string `json:"assignedHost,omitempty"` + BootDiagnostics *BootDiagnosticsInstanceView `json:"bootDiagnostics,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + Disks *[]DiskInstanceView `json:"disks,omitempty"` + Extensions *[]VirtualMachineExtensionInstanceView `json:"extensions,omitempty"` + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + MaintenanceRedeployStatus *MaintenanceRedeployStatus `json:"maintenanceRedeployStatus,omitempty"` + OsName *string `json:"osName,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PlacementGroupId *string `json:"placementGroupId,omitempty"` + PlatformFaultDomain *int64 `json:"platformFaultDomain,omitempty"` + PlatformUpdateDomain *int64 `json:"platformUpdateDomain,omitempty"` + RdpThumbPrint *string `json:"rdpThumbPrint,omitempty"` + Statuses *[]InstanceViewStatus `json:"statuses,omitempty"` + VMAgent *VirtualMachineAgentInstanceView `json:"vmAgent,omitempty"` + VMHealth *VirtualMachineHealthStatus `json:"vmHealth,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go new file mode 100644 index 00000000000..40865049b2e --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmnetworkprofileconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMNetworkProfileConfiguration struct { + NetworkInterfaceConfigurations *[]VirtualMachineScaleSetNetworkConfiguration `json:"networkInterfaceConfigurations,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go new file mode 100644 index 00000000000..387cfc26f36 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmproperties.go @@ -0,0 +1,44 @@ +package virtualmachinescalesetvms + +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 VirtualMachineScaleSetVMProperties struct { + AdditionalCapabilities *AdditionalCapabilities `json:"additionalCapabilities,omitempty"` + AvailabilitySet *SubResource `json:"availabilitySet,omitempty"` + DiagnosticsProfile *DiagnosticsProfile `json:"diagnosticsProfile,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + InstanceView *VirtualMachineScaleSetVMInstanceView `json:"instanceView,omitempty"` + LatestModelApplied *bool `json:"latestModelApplied,omitempty"` + LicenseType *string `json:"licenseType,omitempty"` + ModelDefinitionApplied *string `json:"modelDefinitionApplied,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + NetworkProfileConfiguration *VirtualMachineScaleSetVMNetworkProfileConfiguration `json:"networkProfileConfiguration,omitempty"` + OsProfile *OSProfile `json:"osProfile,omitempty"` + ProtectionPolicy *VirtualMachineScaleSetVMProtectionPolicy `json:"protectionPolicy,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + ResilientVMDeletionStatus *ResilientVMDeletionStatus `json:"resilientVMDeletionStatus,omitempty"` + SecurityProfile *SecurityProfile `json:"securityProfile,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` + TimeCreated *string `json:"timeCreated,omitempty"` + UserData *string `json:"userData,omitempty"` + VMId *string `json:"vmId,omitempty"` +} + +func (o *VirtualMachineScaleSetVMProperties) GetTimeCreatedAsTime() (*time.Time, error) { + if o.TimeCreated == nil { + return nil, nil + } + return dates.ParseAsFormat(o.TimeCreated, "2006-01-02T15:04:05Z07:00") +} + +func (o *VirtualMachineScaleSetVMProperties) SetTimeCreatedAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.TimeCreated = &formatted +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go new file mode 100644 index 00000000000..b3bd8c52f2a --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmprotectionpolicy.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMProtectionPolicy struct { + ProtectFromScaleIn *bool `json:"protectFromScaleIn,omitempty"` + ProtectFromScaleSetActions *bool `json:"protectFromScaleSetActions,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go new file mode 100644 index 00000000000..1b7bf9d3146 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_virtualmachinescalesetvmreimageparameters.go @@ -0,0 +1,11 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMReimageParameters struct { + ExactVersion *string `json:"exactVersion,omitempty"` + ForceUpdateOSDiskForEphemeral *bool `json:"forceUpdateOSDiskForEphemeral,omitempty"` + OsProfile *OSProfileProvisioningData `json:"osProfile,omitempty"` + TempDisk *bool `json:"tempDisk,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go new file mode 100644 index 00000000000..fb043c2e835 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmdisksecurityprofile.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMDiskSecurityProfile struct { + DiskEncryptionSet *SubResource `json:"diskEncryptionSet,omitempty"` + SecurityEncryptionType *SecurityEncryptionTypes `json:"securityEncryptionType,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmsizeproperties.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmsizeproperties.go new file mode 100644 index 00000000000..467974e02e8 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_vmsizeproperties.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMSizeProperties struct { + VCPUsAvailable *int64 `json:"vCPUsAvailable,omitempty"` + VCPUsPerCore *int64 `json:"vCPUsPerCore,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsconfiguration.go new file mode 100644 index 00000000000..67edc81cb90 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsconfiguration.go @@ -0,0 +1,14 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsConfiguration struct { + AdditionalUnattendContent *[]AdditionalUnattendContent `json:"additionalUnattendContent,omitempty"` + EnableAutomaticUpdates *bool `json:"enableAutomaticUpdates,omitempty"` + EnableVMAgentPlatformUpdates *bool `json:"enableVMAgentPlatformUpdates,omitempty"` + PatchSettings *PatchSettings `json:"patchSettings,omitempty"` + ProvisionVMAgent *bool `json:"provisionVMAgent,omitempty"` + TimeZone *string `json:"timeZone,omitempty"` + WinRM *WinRMConfiguration `json:"winRM,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go new file mode 100644 index 00000000000..47e77a5679c --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_windowsvmguestpatchautomaticbyplatformsettings.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WindowsVMGuestPatchAutomaticByPlatformSettings struct { + BypassPlatformSafetyChecksOnUserSchedule *bool `json:"bypassPlatformSafetyChecksOnUserSchedule,omitempty"` + RebootSetting *WindowsVMGuestPatchAutomaticByPlatformRebootSetting `json:"rebootSetting,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmconfiguration.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmconfiguration.go new file mode 100644 index 00000000000..c8f4edf8678 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmconfiguration.go @@ -0,0 +1,8 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMConfiguration struct { + Listeners *[]WinRMListener `json:"listeners,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmlistener.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmlistener.go new file mode 100644 index 00000000000..59cdd2f5c0b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/model_winrmlistener.go @@ -0,0 +1,9 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type WinRMListener struct { + CertificateURL *string `json:"certificateUrl,omitempty"` + Protocol *ProtocolTypes `json:"protocol,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/predicates.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/predicates.go new file mode 100644 index 00000000000..f5a573a7400 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/predicates.go @@ -0,0 +1,42 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineScaleSetVMOperationPredicate struct { + Etag *string + Id *string + InstanceId *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineScaleSetVMOperationPredicate) Matches(input VirtualMachineScaleSetVM) 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.InstanceId != nil && (input.InstanceId == nil || *p.InstanceId != *input.InstanceId) { + 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/compute/2024-11-01/virtualmachinescalesetvms/version.go b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/version.go new file mode 100644 index 00000000000..16fd371aac5 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinescalesetvms/version.go @@ -0,0 +1,10 @@ +package virtualmachinescalesetvms + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinescalesetvms/2024-11-01" +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinesizes/README.md b/resource-manager/compute/2024-11-01/virtualmachinesizes/README.md new file mode 100644 index 00000000000..416fe4e8441 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/README.md @@ -0,0 +1,36 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/compute/2024-11-01/virtualmachinesizes` Documentation + +The `virtualmachinesizes` SDK allows for interaction with Azure Resource Manager `compute` (API Version `2024-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/compute/2024-11-01/virtualmachinesizes" +``` + + +### Client Initialization + +```go +client := virtualmachinesizes.NewVirtualMachineSizesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineSizesClient.List` + +```go +ctx := context.TODO() +id := virtualmachinesizes.NewLocationID("12345678-1234-9876-4563-123456789012", "locationName") + +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/compute/2024-11-01/virtualmachinesizes/client.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/client.go new file mode 100644 index 00000000000..cce54e682d2 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/client.go @@ -0,0 +1,26 @@ +package virtualmachinesizes + +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 VirtualMachineSizesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineSizesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineSizesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "virtualmachinesizes", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineSizesClient: %+v", err) + } + + return &VirtualMachineSizesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinesizes/id_location.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/id_location.go new file mode 100644 index 00000000000..f36bb369b8b --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/id_location.go @@ -0,0 +1,121 @@ +package virtualmachinesizes + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&LocationId{}) +} + +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.Compute/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("staticMicrosoftCompute", "Microsoft.Compute", "Microsoft.Compute"), + resourceids.StaticSegment("staticLocations", "locations", "locations"), + resourceids.UserSpecifiedSegment("locationName", "locationName"), + } +} + +// 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/compute/2024-11-01/virtualmachinesizes/id_location_test.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/id_location_test.go new file mode 100644 index 00000000000..e60ddc571cb --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/id_location_test.go @@ -0,0 +1,237 @@ +package virtualmachinesizes + +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", "locationName") + + 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 != "locationName" { + t.Fatalf("Expected %q but got %q for Segment 'LocationName'", id.LocationName, "locationName") + } +} + +func TestFormatLocationID(t *testing.T) { + actual := NewLocationID("12345678-1234-9876-4563-123456789012", "locationName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName" + 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.Compute", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/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.Compute", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "locationName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/providers/Microsoft.Compute/locations/locationName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE", + Expected: &LocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + LocationName: "lOcAtIoNnAmE", + }, + }, + { + // Invalid (Valid Uri with Extra segment - mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/pRoViDeRs/mIcRoSoFt.cOmPuTe/lOcAtIoNs/lOcAtIoNnAmE/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/compute/2024-11-01/virtualmachinesizes/method_list.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/method_list.go new file mode 100644 index 00000000000..15d02b46c23 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/method_list.go @@ -0,0 +1,54 @@ +package virtualmachinesizes + +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 *VirtualMachineSizeListResult +} + +// List ... +func (c VirtualMachineSizesClient) List(ctx context.Context, id LocationId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/vmSizes", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model VirtualMachineSizeListResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesize.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesize.go new file mode 100644 index 00000000000..9eca92370e9 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesize.go @@ -0,0 +1,13 @@ +package virtualmachinesizes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSize struct { + MaxDataDiskCount *int64 `json:"maxDataDiskCount,omitempty"` + MemoryInMB *int64 `json:"memoryInMB,omitempty"` + Name *string `json:"name,omitempty"` + NumberOfCores *int64 `json:"numberOfCores,omitempty"` + OsDiskSizeInMB *int64 `json:"osDiskSizeInMB,omitempty"` + ResourceDiskSizeInMB *int64 `json:"resourceDiskSizeInMB,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesizelistresult.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesizelistresult.go new file mode 100644 index 00000000000..86db7ace1a7 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/model_virtualmachinesizelistresult.go @@ -0,0 +1,8 @@ +package virtualmachinesizes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineSizeListResult struct { + Value *[]VirtualMachineSize `json:"value,omitempty"` +} diff --git a/resource-manager/compute/2024-11-01/virtualmachinesizes/version.go b/resource-manager/compute/2024-11-01/virtualmachinesizes/version.go new file mode 100644 index 00000000000..0b03f322b95 --- /dev/null +++ b/resource-manager/compute/2024-11-01/virtualmachinesizes/version.go @@ -0,0 +1,10 @@ +package virtualmachinesizes + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2024-11-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/virtualmachinesizes/2024-11-01" +} diff --git a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_hivelinkedservicetypeproperties.go b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_hivelinkedservicetypeproperties.go index 41b5e195890..2b3113983b5 100644 --- a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_hivelinkedservicetypeproperties.go +++ b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_hivelinkedservicetypeproperties.go @@ -9,45 +9,47 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type HiveLinkedServiceTypeProperties struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType HiveAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Password SecretBase `json:"password"` - Port *int64 `json:"port,omitempty"` - ServerType *HiveServerType `json:"serverType,omitempty"` - ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` - ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseNativeQuery *bool `json:"useNativeQuery,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` - ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType HiveAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Password SecretBase `json:"password"` + Port *int64 `json:"port,omitempty"` + ServerType *HiveServerType `json:"serverType,omitempty"` + ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` + ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseNativeQuery *bool `json:"useNativeQuery,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` + ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` } var _ json.Unmarshaler = &HiveLinkedServiceTypeProperties{} func (s *HiveLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { var decoded struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType HiveAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Port *int64 `json:"port,omitempty"` - ServerType *HiveServerType `json:"serverType,omitempty"` - ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` - ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseNativeQuery *bool `json:"useNativeQuery,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` - ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType HiveAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Port *int64 `json:"port,omitempty"` + ServerType *HiveServerType `json:"serverType,omitempty"` + ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` + ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseNativeQuery *bool `json:"useNativeQuery,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` + ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -56,6 +58,7 @@ func (s *HiveLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { s.AllowHostNameCNMismatch = decoded.AllowHostNameCNMismatch s.AllowSelfSignedServerCert = decoded.AllowSelfSignedServerCert s.AuthenticationType = decoded.AuthenticationType + s.EnableServerCertificateValidation = decoded.EnableServerCertificateValidation s.EnableSsl = decoded.EnableSsl s.EncryptedCredential = decoded.EncryptedCredential s.HTTPPath = decoded.HTTPPath diff --git a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_sparklinkedservicetypeproperties.go b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_sparklinkedservicetypeproperties.go index 68ab10b7ee5..33446b867ba 100644 --- a/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_sparklinkedservicetypeproperties.go +++ b/resource-manager/datafactory/2018-06-01/dataflowdebugsession/model_sparklinkedservicetypeproperties.go @@ -9,39 +9,41 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SparkLinkedServiceTypeProperties struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType SparkAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Password SecretBase `json:"password"` - Port int64 `json:"port"` - ServerType *SparkServerType `json:"serverType,omitempty"` - ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType SparkAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Password SecretBase `json:"password"` + Port int64 `json:"port"` + ServerType *SparkServerType `json:"serverType,omitempty"` + ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` } var _ json.Unmarshaler = &SparkLinkedServiceTypeProperties{} func (s *SparkLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { var decoded struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType SparkAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Port int64 `json:"port"` - ServerType *SparkServerType `json:"serverType,omitempty"` - ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType SparkAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Port int64 `json:"port"` + ServerType *SparkServerType `json:"serverType,omitempty"` + ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -50,6 +52,7 @@ func (s *SparkLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { s.AllowHostNameCNMismatch = decoded.AllowHostNameCNMismatch s.AllowSelfSignedServerCert = decoded.AllowSelfSignedServerCert s.AuthenticationType = decoded.AuthenticationType + s.EnableServerCertificateValidation = decoded.EnableServerCertificateValidation s.EnableSsl = decoded.EnableSsl s.EncryptedCredential = decoded.EncryptedCredential s.HTTPPath = decoded.HTTPPath diff --git a/resource-manager/datafactory/2018-06-01/linkedservices/model_hivelinkedservicetypeproperties.go b/resource-manager/datafactory/2018-06-01/linkedservices/model_hivelinkedservicetypeproperties.go index ec19cb62493..da7ddc2ce77 100644 --- a/resource-manager/datafactory/2018-06-01/linkedservices/model_hivelinkedservicetypeproperties.go +++ b/resource-manager/datafactory/2018-06-01/linkedservices/model_hivelinkedservicetypeproperties.go @@ -9,45 +9,47 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type HiveLinkedServiceTypeProperties struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType HiveAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Password SecretBase `json:"password"` - Port *int64 `json:"port,omitempty"` - ServerType *HiveServerType `json:"serverType,omitempty"` - ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` - ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseNativeQuery *bool `json:"useNativeQuery,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` - ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType HiveAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Password SecretBase `json:"password"` + Port *int64 `json:"port,omitempty"` + ServerType *HiveServerType `json:"serverType,omitempty"` + ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` + ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseNativeQuery *bool `json:"useNativeQuery,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` + ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` } var _ json.Unmarshaler = &HiveLinkedServiceTypeProperties{} func (s *HiveLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { var decoded struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType HiveAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Port *int64 `json:"port,omitempty"` - ServerType *HiveServerType `json:"serverType,omitempty"` - ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` - ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseNativeQuery *bool `json:"useNativeQuery,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` - ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType HiveAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Port *int64 `json:"port,omitempty"` + ServerType *HiveServerType `json:"serverType,omitempty"` + ServiceDiscoveryMode *bool `json:"serviceDiscoveryMode,omitempty"` + ThriftTransportProtocol *HiveThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseNativeQuery *bool `json:"useNativeQuery,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` + ZooKeeperNameSpace *interface{} `json:"zooKeeperNameSpace,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -56,6 +58,7 @@ func (s *HiveLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { s.AllowHostNameCNMismatch = decoded.AllowHostNameCNMismatch s.AllowSelfSignedServerCert = decoded.AllowSelfSignedServerCert s.AuthenticationType = decoded.AuthenticationType + s.EnableServerCertificateValidation = decoded.EnableServerCertificateValidation s.EnableSsl = decoded.EnableSsl s.EncryptedCredential = decoded.EncryptedCredential s.HTTPPath = decoded.HTTPPath diff --git a/resource-manager/datafactory/2018-06-01/linkedservices/model_sparklinkedservicetypeproperties.go b/resource-manager/datafactory/2018-06-01/linkedservices/model_sparklinkedservicetypeproperties.go index d9ebdcd23ac..c4b25d38ac5 100644 --- a/resource-manager/datafactory/2018-06-01/linkedservices/model_sparklinkedservicetypeproperties.go +++ b/resource-manager/datafactory/2018-06-01/linkedservices/model_sparklinkedservicetypeproperties.go @@ -9,39 +9,41 @@ import ( // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type SparkLinkedServiceTypeProperties struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType SparkAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Password SecretBase `json:"password"` - Port int64 `json:"port"` - ServerType *SparkServerType `json:"serverType,omitempty"` - ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType SparkAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Password SecretBase `json:"password"` + Port int64 `json:"port"` + ServerType *SparkServerType `json:"serverType,omitempty"` + ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` } var _ json.Unmarshaler = &SparkLinkedServiceTypeProperties{} func (s *SparkLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { var decoded struct { - AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` - AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` - AuthenticationType SparkAuthenticationType `json:"authenticationType"` - EnableSsl *bool `json:"enableSsl,omitempty"` - EncryptedCredential *string `json:"encryptedCredential,omitempty"` - HTTPPath *interface{} `json:"httpPath,omitempty"` - Host interface{} `json:"host"` - Port int64 `json:"port"` - ServerType *SparkServerType `json:"serverType,omitempty"` - ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` - TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` - UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` - Username *interface{} `json:"username,omitempty"` + AllowHostNameCNMismatch *bool `json:"allowHostNameCNMismatch,omitempty"` + AllowSelfSignedServerCert *bool `json:"allowSelfSignedServerCert,omitempty"` + AuthenticationType SparkAuthenticationType `json:"authenticationType"` + EnableServerCertificateValidation *bool `json:"enableServerCertificateValidation,omitempty"` + EnableSsl *bool `json:"enableSsl,omitempty"` + EncryptedCredential *string `json:"encryptedCredential,omitempty"` + HTTPPath *interface{} `json:"httpPath,omitempty"` + Host interface{} `json:"host"` + Port int64 `json:"port"` + ServerType *SparkServerType `json:"serverType,omitempty"` + ThriftTransportProtocol *SparkThriftTransportProtocol `json:"thriftTransportProtocol,omitempty"` + TrustedCertPath *interface{} `json:"trustedCertPath,omitempty"` + UseSystemTrustStore *bool `json:"useSystemTrustStore,omitempty"` + Username *interface{} `json:"username,omitempty"` } if err := json.Unmarshal(bytes, &decoded); err != nil { return fmt.Errorf("unmarshaling: %+v", err) @@ -50,6 +52,7 @@ func (s *SparkLinkedServiceTypeProperties) UnmarshalJSON(bytes []byte) error { s.AllowHostNameCNMismatch = decoded.AllowHostNameCNMismatch s.AllowSelfSignedServerCert = decoded.AllowSelfSignedServerCert s.AuthenticationType = decoded.AuthenticationType + s.EnableServerCertificateValidation = decoded.EnableServerCertificateValidation s.EnableSsl = decoded.EnableSsl s.EncryptedCredential = decoded.EncryptedCredential s.HTTPPath = decoded.HTTPPath diff --git a/resource-manager/network/2024-05-01/loadbalancers/model_loadbalancerhealthperruleperbackendaddress.go b/resource-manager/network/2024-05-01/loadbalancers/model_loadbalancerhealthperruleperbackendaddress.go index fdbf857b827..aa593f8cb9a 100644 --- a/resource-manager/network/2024-05-01/loadbalancers/model_loadbalancerhealthperruleperbackendaddress.go +++ b/resource-manager/network/2024-05-01/loadbalancers/model_loadbalancerhealthperruleperbackendaddress.go @@ -4,8 +4,8 @@ package loadbalancers // Licensed under the MIT License. See NOTICE.txt in the project root for license information. type LoadBalancerHealthPerRulePerBackendAddress struct { - IPAddress *string `json:"ipAddress,omitempty"` - NetworkInterfaceIPConfigurationId *NetworkInterfaceIPConfiguration `json:"networkInterfaceIPConfigurationId,omitempty"` - Reason *string `json:"reason,omitempty"` - State *string `json:"state,omitempty"` + IPAddress *string `json:"ipAddress,omitempty"` + NetworkInterfaceIPConfigurationId *string `json:"networkInterfaceIPConfigurationId,omitempty"` + Reason *string `json:"reason,omitempty"` + State *string `json:"state,omitempty"` } diff --git a/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go b/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go index 793caeabedc..c9291fb2fab 100644 --- a/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go +++ b/resource-manager/network/2024-05-01/networkmanageractiveconfigurations/constants.go @@ -138,8 +138,6 @@ func parseGroupMemberType(input string) (*GroupMemberType, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -148,8 +146,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -172,8 +168,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go b/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go index 6f3a6c4f554..642ecd4a0bd 100644 --- a/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go +++ b/resource-manager/network/2024-05-01/networkmanageractiveconnectivityconfigurations/constants.go @@ -217,8 +217,6 @@ func parseIsGlobal(input string) (*IsGlobal, error) { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" ProvisioningStateDeleting ProvisioningState = "Deleting" ProvisioningStateFailed ProvisioningState = "Failed" ProvisioningStateSucceeded ProvisioningState = "Succeeded" @@ -227,8 +225,6 @@ const ( func PossibleValuesForProvisioningState() []string { return []string{ - string(ProvisioningStateCanceled), - string(ProvisioningStateCreating), string(ProvisioningStateDeleting), string(ProvisioningStateFailed), string(ProvisioningStateSucceeded), @@ -251,8 +247,6 @@ func (s *ProvisioningState) UnmarshalJSON(bytes []byte) error { func parseProvisioningState(input string) (*ProvisioningState, error) { vals := map[string]ProvisioningState{ - "canceled": ProvisioningStateCanceled, - "creating": ProvisioningStateCreating, "deleting": ProvisioningStateDeleting, "failed": ProvisioningStateFailed, "succeeded": ProvisioningStateSucceeded, diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/README.md b/resource-manager/videoindexer/2025-04-01/accesstoken/README.md new file mode 100644 index 00000000000..d82f80195d0 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/README.md @@ -0,0 +1,62 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/accesstoken` Documentation + +The `accesstoken` SDK allows for interaction with Azure Resource Manager `videoindexer` (API Version `2025-04-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/videoindexer/2025-04-01/accesstoken" +``` + + +### Client Initialization + +```go +client := accesstoken.NewAccessTokenClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccessTokenClient.GenerateAccessToken` + +```go +ctx := context.TODO() +id := accesstoken.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +payload := accesstoken.GenerateAccessTokenParameters{ + // ... +} + + +read, err := client.GenerateAccessToken(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccessTokenClient.GenerateRestrictedViewerAccessToken` + +```go +ctx := context.TODO() +id := accesstoken.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +payload := accesstoken.GenerateRestrictedViewerAccessTokenParameters{ + // ... +} + + +read, err := client.GenerateRestrictedViewerAccessToken(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/client.go b/resource-manager/videoindexer/2025-04-01/accesstoken/client.go new file mode 100644 index 00000000000..436fa8abb5b --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/client.go @@ -0,0 +1,26 @@ +package accesstoken + +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 AccessTokenClient struct { + Client *resourcemanager.Client +} + +func NewAccessTokenClientWithBaseURI(sdkApi sdkEnv.Api) (*AccessTokenClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "accesstoken", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AccessTokenClient: %+v", err) + } + + return &AccessTokenClient{ + Client: client, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/constants.go b/resource-manager/videoindexer/2025-04-01/accesstoken/constants.go new file mode 100644 index 00000000000..b2b528e7650 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/constants.go @@ -0,0 +1,95 @@ +package accesstoken + +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 PermissionType string + +const ( + PermissionTypeContributor PermissionType = "Contributor" + PermissionTypeReader PermissionType = "Reader" +) + +func PossibleValuesForPermissionType() []string { + return []string{ + string(PermissionTypeContributor), + string(PermissionTypeReader), + } +} + +func (s *PermissionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePermissionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePermissionType(input string) (*PermissionType, error) { + vals := map[string]PermissionType{ + "contributor": PermissionTypeContributor, + "reader": PermissionTypeReader, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PermissionType(input) + return &out, nil +} + +type Scope string + +const ( + ScopeAccount Scope = "Account" + ScopeProject Scope = "Project" + ScopeVideo Scope = "Video" +) + +func PossibleValuesForScope() []string { + return []string{ + string(ScopeAccount), + string(ScopeProject), + string(ScopeVideo), + } +} + +func (s *Scope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScope(input string) (*Scope, error) { + vals := map[string]Scope{ + "account": ScopeAccount, + "project": ScopeProject, + "video": ScopeVideo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scope(input) + return &out, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/id_account.go b/resource-manager/videoindexer/2025-04-01/accesstoken/id_account.go new file mode 100644 index 00000000000..7b3176cc27c --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/id_account.go @@ -0,0 +1,130 @@ +package accesstoken + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccountId{}) +} + +var _ resourceids.ResourceId = &AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + return nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/id_account_test.go b/resource-manager/videoindexer/2025-04-01/accesstoken/id_account_test.go new file mode 100644 index 00000000000..365ecbf7568 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/id_account_test.go @@ -0,0 +1,282 @@ +package accesstoken + +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 = &AccountId{} + +func TestNewAccountID(t *testing.T) { + id := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } +} + +func TestFormatAccountID(t *testing.T) { + actual := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccountID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestParseAccountIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestSegmentsForAccountId(t *testing.T) { + segments := AccountId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccountId 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/videoindexer/2025-04-01/accesstoken/method_generateaccesstoken.go b/resource-manager/videoindexer/2025-04-01/accesstoken/method_generateaccesstoken.go new file mode 100644 index 00000000000..11653e60193 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/method_generateaccesstoken.go @@ -0,0 +1,58 @@ +package accesstoken + +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 GenerateAccessTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessToken +} + +// GenerateAccessToken ... +func (c AccessTokenClient) GenerateAccessToken(ctx context.Context, id AccountId, input GenerateAccessTokenParameters) (result GenerateAccessTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateAccessToken", 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 + } + + var model AccessToken + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/method_generaterestrictedvieweraccesstoken.go b/resource-manager/videoindexer/2025-04-01/accesstoken/method_generaterestrictedvieweraccesstoken.go new file mode 100644 index 00000000000..9df410a9b5b --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/method_generaterestrictedvieweraccesstoken.go @@ -0,0 +1,58 @@ +package accesstoken + +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 GenerateRestrictedViewerAccessTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessToken +} + +// GenerateRestrictedViewerAccessToken ... +func (c AccessTokenClient) GenerateRestrictedViewerAccessToken(ctx context.Context, id AccountId, input GenerateRestrictedViewerAccessTokenParameters) (result GenerateRestrictedViewerAccessTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateRestrictedViewerAccessToken", 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 + } + + var model AccessToken + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/model_accesstoken.go b/resource-manager/videoindexer/2025-04-01/accesstoken/model_accesstoken.go new file mode 100644 index 00000000000..f124e78355d --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/model_accesstoken.go @@ -0,0 +1,8 @@ +package accesstoken + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessToken struct { + AccessToken *string `json:"accessToken,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/model_generateaccesstokenparameters.go b/resource-manager/videoindexer/2025-04-01/accesstoken/model_generateaccesstokenparameters.go new file mode 100644 index 00000000000..0d88cde821f --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/model_generateaccesstokenparameters.go @@ -0,0 +1,11 @@ +package accesstoken + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateAccessTokenParameters struct { + PermissionType PermissionType `json:"permissionType"` + ProjectId *string `json:"projectId,omitempty"` + Scope Scope `json:"scope"` + VideoId *string `json:"videoId,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/model_generaterestrictedvieweraccesstokenparameters.go b/resource-manager/videoindexer/2025-04-01/accesstoken/model_generaterestrictedvieweraccesstokenparameters.go new file mode 100644 index 00000000000..f14a8b55ae6 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/model_generaterestrictedvieweraccesstokenparameters.go @@ -0,0 +1,10 @@ +package accesstoken + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateRestrictedViewerAccessTokenParameters struct { + ProjectId *string `json:"projectId,omitempty"` + Scope Scope `json:"scope"` + VideoId *string `json:"videoId,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accesstoken/version.go b/resource-manager/videoindexer/2025-04-01/accesstoken/version.go new file mode 100644 index 00000000000..d097396ddd9 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accesstoken/version.go @@ -0,0 +1,10 @@ +package accesstoken + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/accesstoken/2025-04-01" +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/README.md b/resource-manager/videoindexer/2025-04-01/accounts/README.md new file mode 100644 index 00000000000..e2eeb23b730 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/README.md @@ -0,0 +1,129 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/accounts` Documentation + +The `accounts` SDK allows for interaction with Azure Resource Manager `videoindexer` (API Version `2025-04-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/accounts" +``` + + +### Client Initialization + +```go +client := accounts.NewAccountsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AccountsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +payload := accounts.Account{ + // ... +} + + +read, err := client.CreateOrUpdate(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.Delete` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +read, err := client.Delete(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `AccountsClient.Get` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +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: `AccountsClient.List` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +// 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: `AccountsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := commonids.NewResourceGroupID("12345678-1234-9876-4563-123456789012", "example-resource-group") + +// alternatively `client.ListByResourceGroup(ctx, id)` can be used to do batched pagination +items, err := client.ListByResourceGroupComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `AccountsClient.Update` + +```go +ctx := context.TODO() +id := accounts.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +payload := accounts.AccountPatch{ + // ... +} + + +read, err := client.Update(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/videoindexer/2025-04-01/accounts/client.go b/resource-manager/videoindexer/2025-04-01/accounts/client.go new file mode 100644 index 00000000000..98743867a01 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/client.go @@ -0,0 +1,26 @@ +package accounts + +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 AccountsClient struct { + Client *resourcemanager.Client +} + +func NewAccountsClientWithBaseURI(sdkApi sdkEnv.Api) (*AccountsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "accounts", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AccountsClient: %+v", err) + } + + return &AccountsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/constants.go b/resource-manager/videoindexer/2025-04-01/accounts/constants.go new file mode 100644 index 00000000000..02866106e56 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/constants.go @@ -0,0 +1,195 @@ +package accounts + +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 PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + 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, + "canceled": ProvisioningStateCanceled, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "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 PublicNetworkAccess string + +const ( + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +func PossibleValuesForPublicNetworkAccess() []string { + return []string{ + string(PublicNetworkAccessDisabled), + string(PublicNetworkAccessEnabled), + } +} + +func (s *PublicNetworkAccess) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePublicNetworkAccess(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePublicNetworkAccess(input string) (*PublicNetworkAccess, error) { + vals := map[string]PublicNetworkAccess{ + "disabled": PublicNetworkAccessDisabled, + "enabled": PublicNetworkAccessEnabled, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PublicNetworkAccess(input) + return &out, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/id_account.go b/resource-manager/videoindexer/2025-04-01/accounts/id_account.go new file mode 100644 index 00000000000..a157e0c0633 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/id_account.go @@ -0,0 +1,130 @@ +package accounts + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccountId{}) +} + +var _ resourceids.ResourceId = &AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + return nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/id_account_test.go b/resource-manager/videoindexer/2025-04-01/accounts/id_account_test.go new file mode 100644 index 00000000000..a3dcd4d17bf --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/id_account_test.go @@ -0,0 +1,282 @@ +package accounts + +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 = &AccountId{} + +func TestNewAccountID(t *testing.T) { + id := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } +} + +func TestFormatAccountID(t *testing.T) { + actual := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccountID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestParseAccountIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestSegmentsForAccountId(t *testing.T) { + segments := AccountId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccountId 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/videoindexer/2025-04-01/accounts/method_createorupdate.go b/resource-manager/videoindexer/2025-04-01/accounts/method_createorupdate.go new file mode 100644 index 00000000000..81dec8fdd4f --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/method_createorupdate.go @@ -0,0 +1,58 @@ +package accounts + +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 CreateOrUpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Account +} + +// CreateOrUpdate ... +func (c AccountsClient) CreateOrUpdate(ctx context.Context, id AccountId, input Account) (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 + } + + var model Account + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/method_delete.go b/resource-manager/videoindexer/2025-04-01/accounts/method_delete.go new file mode 100644 index 00000000000..f17e64b86dd --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/method_delete.go @@ -0,0 +1,48 @@ +package accounts + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c AccountsClient) Delete(ctx context.Context, id AccountId) (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 + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/method_get.go b/resource-manager/videoindexer/2025-04-01/accounts/method_get.go new file mode 100644 index 00000000000..f8809d82ac1 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/method_get.go @@ -0,0 +1,53 @@ +package accounts + +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 *Account +} + +// Get ... +func (c AccountsClient) Get(ctx context.Context, id AccountId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model Account + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/method_list.go b/resource-manager/videoindexer/2025-04-01/accounts/method_list.go new file mode 100644 index 00000000000..609663a35b6 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/method_list.go @@ -0,0 +1,106 @@ +package accounts + +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 ListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Account +} + +type ListCompleteResult struct { + LatestHttpResponse *http.Response + Items []Account +} + +type ListCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// List ... +func (c AccountsClient) List(ctx context.Context, id commonids.SubscriptionId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.VideoIndexer/accounts", 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 *[]Account `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 AccountsClient) ListComplete(ctx context.Context, id commonids.SubscriptionId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AccountsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AccountOperationPredicate) (result ListCompleteResult, err error) { + items := make([]Account, 0) + + resp, err := c.List(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/method_listbyresourcegroup.go b/resource-manager/videoindexer/2025-04-01/accounts/method_listbyresourcegroup.go new file mode 100644 index 00000000000..38e5364c0b6 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/method_listbyresourcegroup.go @@ -0,0 +1,106 @@ +package accounts + +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]Account +} + +type ListByResourceGroupCompleteResult struct { + LatestHttpResponse *http.Response + Items []Account +} + +type ListByResourceGroupCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByResourceGroupCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByResourceGroup ... +func (c AccountsClient) ListByResourceGroup(ctx context.Context, id commonids.ResourceGroupId) (result ListByResourceGroupOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByResourceGroupCustomPager{}, + Path: fmt.Sprintf("%s/providers/Microsoft.VideoIndexer/accounts", 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 *[]Account `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c AccountsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AccountOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AccountsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AccountOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Account, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/method_update.go b/resource-manager/videoindexer/2025-04-01/accounts/method_update.go new file mode 100644 index 00000000000..ab275b88280 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/method_update.go @@ -0,0 +1,57 @@ +package accounts + +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 UpdateOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *Account +} + +// Update ... +func (c AccountsClient) Update(ctx context.Context, id AccountId, input AccountPatch) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + 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 + } + + var model Account + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_account.go b/resource-manager/videoindexer/2025-04-01/accounts/model_account.go new file mode 100644 index 00000000000..2f829055165 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_account.go @@ -0,0 +1,20 @@ +package accounts + +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 Account struct { + Id *string `json:"id,omitempty"` + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *AccountPropertiesForPutRequest `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/videoindexer/2025-04-01/accounts/model_accountpatch.go b/resource-manager/videoindexer/2025-04-01/accounts/model_accountpatch.go new file mode 100644 index 00000000000..a1992e3760a --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_accountpatch.go @@ -0,0 +1,14 @@ +package accounts + +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 AccountPatch struct { + Identity *identity.LegacySystemAndUserAssignedMap `json:"identity,omitempty"` + Properties *AccountPropertiesForPatchRequest `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforpatchrequest.go b/resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforpatchrequest.go new file mode 100644 index 00000000000..9b57f5256ea --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforpatchrequest.go @@ -0,0 +1,14 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountPropertiesForPatchRequest struct { + AccountId *string `json:"accountId,omitempty"` + OpenAiServices *OpenAiServicesForPatchRequest `json:"openAiServices,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + StorageServices *StorageServicesForPatchRequest `json:"storageServices,omitempty"` + TenantId *string `json:"tenantId,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforputrequest.go b/resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforputrequest.go new file mode 100644 index 00000000000..94880980906 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_accountpropertiesforputrequest.go @@ -0,0 +1,17 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountPropertiesForPutRequest struct { + AccountId *string `json:"accountId,omitempty"` + AccountName *string `json:"accountName,omitempty"` + OpenAiServices *OpenAiServicesForPutRequest `json:"openAiServices,omitempty"` + PrivateEndpointConnections *[]PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` + StorageServices *StorageServicesForPutRequest `json:"storageServices,omitempty"` + TenantId *string `json:"tenantId,omitempty"` + TotalMinutesIndexed *int64 `json:"totalMinutesIndexed,omitempty"` + TotalSecondsIndexed *int64 `json:"totalSecondsIndexed,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforpatchrequest.go b/resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforpatchrequest.go new file mode 100644 index 00000000000..b4c54f65b56 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforpatchrequest.go @@ -0,0 +1,9 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenAiServicesForPatchRequest struct { + ResourceId *string `json:"resourceId,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforputrequest.go b/resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforputrequest.go new file mode 100644 index 00000000000..a1c1b4ef97b --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_openaiservicesforputrequest.go @@ -0,0 +1,9 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OpenAiServicesForPutRequest struct { + ResourceId *string `json:"resourceId,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpoint.go b/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpoint.go new file mode 100644 index 00000000000..02b184cde73 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpoint.go @@ -0,0 +1,8 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnection.go b/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnection.go new file mode 100644 index 00000000000..1c4e89b0a91 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package accounts + +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 PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnectionproperties.go b/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..c9ca5bc5fde --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_privatelinkserviceconnectionstate.go b/resource-manager/videoindexer/2025-04-01/accounts/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..c7ce04574ec --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforpatchrequest.go b/resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforpatchrequest.go new file mode 100644 index 00000000000..79430211e9d --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforpatchrequest.go @@ -0,0 +1,8 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageServicesForPatchRequest struct { + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforputrequest.go b/resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforputrequest.go new file mode 100644 index 00000000000..4442b17dcd4 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/model_storageservicesforputrequest.go @@ -0,0 +1,9 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageServicesForPutRequest struct { + ResourceId *string `json:"resourceId,omitempty"` + UserAssignedIdentity *string `json:"userAssignedIdentity,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/accounts/predicates.go b/resource-manager/videoindexer/2025-04-01/accounts/predicates.go new file mode 100644 index 00000000000..12ee50a1dee --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/predicates.go @@ -0,0 +1,32 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p AccountOperationPredicate) Matches(input Account) 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/videoindexer/2025-04-01/accounts/version.go b/resource-manager/videoindexer/2025-04-01/accounts/version.go new file mode 100644 index 00000000000..15f542ce8d7 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/accounts/version.go @@ -0,0 +1,10 @@ +package accounts + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/accounts/2025-04-01" +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/README.md b/resource-manager/videoindexer/2025-04-01/arc/README.md new file mode 100644 index 00000000000..8ec5a90a9c2 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/README.md @@ -0,0 +1,62 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/arc` Documentation + +The `arc` SDK allows for interaction with Azure Resource Manager `videoindexer` (API Version `2025-04-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/videoindexer/2025-04-01/arc" +``` + + +### Client Initialization + +```go +client := arc.NewArcClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ArcClient.GenerateExtensionAccessToken` + +```go +ctx := context.TODO() +id := arc.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +payload := arc.GenerateExtensionAccessTokenParameters{ + // ... +} + + +read, err := client.GenerateExtensionAccessToken(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ArcClient.GenerateExtensionRestrictedViewerAccessToken` + +```go +ctx := context.TODO() +id := arc.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +payload := arc.GenerateExtensionRestrictedViewerAccessTokenParameters{ + // ... +} + + +read, err := client.GenerateExtensionRestrictedViewerAccessToken(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/videoindexer/2025-04-01/arc/client.go b/resource-manager/videoindexer/2025-04-01/arc/client.go new file mode 100644 index 00000000000..f800185b52c --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/client.go @@ -0,0 +1,26 @@ +package arc + +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 ArcClient struct { + Client *resourcemanager.Client +} + +func NewArcClientWithBaseURI(sdkApi sdkEnv.Api) (*ArcClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "arc", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating ArcClient: %+v", err) + } + + return &ArcClient{ + Client: client, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/constants.go b/resource-manager/videoindexer/2025-04-01/arc/constants.go new file mode 100644 index 00000000000..fe01302cd6f --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/constants.go @@ -0,0 +1,95 @@ +package arc + +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 PermissionType string + +const ( + PermissionTypeContributor PermissionType = "Contributor" + PermissionTypeReader PermissionType = "Reader" +) + +func PossibleValuesForPermissionType() []string { + return []string{ + string(PermissionTypeContributor), + string(PermissionTypeReader), + } +} + +func (s *PermissionType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePermissionType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePermissionType(input string) (*PermissionType, error) { + vals := map[string]PermissionType{ + "contributor": PermissionTypeContributor, + "reader": PermissionTypeReader, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PermissionType(input) + return &out, nil +} + +type Scope string + +const ( + ScopeAccount Scope = "Account" + ScopeProject Scope = "Project" + ScopeVideo Scope = "Video" +) + +func PossibleValuesForScope() []string { + return []string{ + string(ScopeAccount), + string(ScopeProject), + string(ScopeVideo), + } +} + +func (s *Scope) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseScope(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseScope(input string) (*Scope, error) { + vals := map[string]Scope{ + "account": ScopeAccount, + "project": ScopeProject, + "video": ScopeVideo, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Scope(input) + return &out, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/id_account.go b/resource-manager/videoindexer/2025-04-01/arc/id_account.go new file mode 100644 index 00000000000..b04e88ea6bd --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/id_account.go @@ -0,0 +1,130 @@ +package arc + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccountId{}) +} + +var _ resourceids.ResourceId = &AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + return nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/id_account_test.go b/resource-manager/videoindexer/2025-04-01/arc/id_account_test.go new file mode 100644 index 00000000000..31af4724702 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/id_account_test.go @@ -0,0 +1,282 @@ +package arc + +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 = &AccountId{} + +func TestNewAccountID(t *testing.T) { + id := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } +} + +func TestFormatAccountID(t *testing.T) { + actual := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccountID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestParseAccountIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestSegmentsForAccountId(t *testing.T) { + segments := AccountId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccountId 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/videoindexer/2025-04-01/arc/method_generateextensionaccesstoken.go b/resource-manager/videoindexer/2025-04-01/arc/method_generateextensionaccesstoken.go new file mode 100644 index 00000000000..9f153741e14 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/method_generateextensionaccesstoken.go @@ -0,0 +1,58 @@ +package arc + +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 GenerateExtensionAccessTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessToken +} + +// GenerateExtensionAccessToken ... +func (c ArcClient) GenerateExtensionAccessToken(ctx context.Context, id AccountId, input GenerateExtensionAccessTokenParameters) (result GenerateExtensionAccessTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateExtensionAccessToken", 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 + } + + var model AccessToken + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/method_generateextensionrestrictedvieweraccesstoken.go b/resource-manager/videoindexer/2025-04-01/arc/method_generateextensionrestrictedvieweraccesstoken.go new file mode 100644 index 00000000000..398fe54a698 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/method_generateextensionrestrictedvieweraccesstoken.go @@ -0,0 +1,58 @@ +package arc + +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 GenerateExtensionRestrictedViewerAccessTokenOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *AccessToken +} + +// GenerateExtensionRestrictedViewerAccessToken ... +func (c ArcClient) GenerateExtensionRestrictedViewerAccessToken(ctx context.Context, id AccountId, input GenerateExtensionRestrictedViewerAccessTokenParameters) (result GenerateExtensionRestrictedViewerAccessTokenOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/generateExtensionRestrictedViewerAccessToken", 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 + } + + var model AccessToken + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/model_accesstoken.go b/resource-manager/videoindexer/2025-04-01/arc/model_accesstoken.go new file mode 100644 index 00000000000..5d6317e0cb5 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/model_accesstoken.go @@ -0,0 +1,8 @@ +package arc + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccessToken struct { + AccessToken *string `json:"accessToken,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/model_generateextensionaccesstokenparameters.go b/resource-manager/videoindexer/2025-04-01/arc/model_generateextensionaccesstokenparameters.go new file mode 100644 index 00000000000..d03187702cb --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/model_generateextensionaccesstokenparameters.go @@ -0,0 +1,12 @@ +package arc + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateExtensionAccessTokenParameters struct { + ExtensionId string `json:"extensionId"` + PermissionType PermissionType `json:"permissionType"` + Scope Scope `json:"scope"` + TokenLifetimeInSeconds *int64 `json:"tokenLifetimeInSeconds,omitempty"` + VideoId *string `json:"videoId,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/model_generateextensionrestrictedvieweraccesstokenparameters.go b/resource-manager/videoindexer/2025-04-01/arc/model_generateextensionrestrictedvieweraccesstokenparameters.go new file mode 100644 index 00000000000..6046f053394 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/model_generateextensionrestrictedvieweraccesstokenparameters.go @@ -0,0 +1,11 @@ +package arc + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GenerateExtensionRestrictedViewerAccessTokenParameters struct { + ExtensionId string `json:"extensionId"` + Scope Scope `json:"scope"` + TokenLifetimeInSeconds *int64 `json:"tokenLifetimeInSeconds,omitempty"` + VideoId *string `json:"videoId,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/arc/version.go b/resource-manager/videoindexer/2025-04-01/arc/version.go new file mode 100644 index 00000000000..2d14343a8f0 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/arc/version.go @@ -0,0 +1,10 @@ +package arc + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/arc/2025-04-01" +} diff --git a/resource-manager/videoindexer/2025-04-01/client.go b/resource-manager/videoindexer/2025-04-01/client.go new file mode 100644 index 00000000000..75b7b075e61 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/client.go @@ -0,0 +1,73 @@ +package v2025_04_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/videoindexer/2025-04-01/accesstoken" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/accounts" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/arc" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/nameavailability" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/privateendpointconnections" + "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/privatelinkresources" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AccessToken *accesstoken.AccessTokenClient + Accounts *accounts.AccountsClient + Arc *arc.ArcClient + NameAvailability *nameavailability.NameAvailabilityClient + PrivateEndpointConnections *privateendpointconnections.PrivateEndpointConnectionsClient + PrivateLinkResources *privatelinkresources.PrivateLinkResourcesClient +} + +func NewClientWithBaseURI(sdkApi sdkEnv.Api, configureFunc func(c *resourcemanager.Client)) (*Client, error) { + accessTokenClient, err := accesstoken.NewAccessTokenClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building AccessToken client: %+v", err) + } + configureFunc(accessTokenClient.Client) + + accountsClient, err := accounts.NewAccountsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Accounts client: %+v", err) + } + configureFunc(accountsClient.Client) + + arcClient, err := arc.NewArcClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Arc client: %+v", err) + } + configureFunc(arcClient.Client) + + nameAvailabilityClient, err := nameavailability.NewNameAvailabilityClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building NameAvailability client: %+v", err) + } + configureFunc(nameAvailabilityClient.Client) + + privateEndpointConnectionsClient, err := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateEndpointConnections client: %+v", err) + } + configureFunc(privateEndpointConnectionsClient.Client) + + privateLinkResourcesClient, err := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building PrivateLinkResources client: %+v", err) + } + configureFunc(privateLinkResourcesClient.Client) + + return &Client{ + AccessToken: accessTokenClient, + Accounts: accountsClient, + Arc: arcClient, + NameAvailability: nameAvailabilityClient, + PrivateEndpointConnections: privateEndpointConnectionsClient, + PrivateLinkResources: privateLinkResourcesClient, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/nameavailability/README.md b/resource-manager/videoindexer/2025-04-01/nameavailability/README.md new file mode 100644 index 00000000000..b9fc1cbba03 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/README.md @@ -0,0 +1,42 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/nameavailability` Documentation + +The `nameavailability` SDK allows for interaction with Azure Resource Manager `videoindexer` (API Version `2025-04-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-helpers/resourcemanager/commonids" +import "github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/nameavailability" +``` + + +### Client Initialization + +```go +client := nameavailability.NewNameAvailabilityClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `NameAvailabilityClient.AccountsCheckNameAvailability` + +```go +ctx := context.TODO() +id := commonids.NewSubscriptionID("12345678-1234-9876-4563-123456789012") + +payload := nameavailability.AccountCheckNameAvailabilityParameters{ + // ... +} + + +read, err := client.AccountsCheckNameAvailability(ctx, id, payload) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` diff --git a/resource-manager/videoindexer/2025-04-01/nameavailability/client.go b/resource-manager/videoindexer/2025-04-01/nameavailability/client.go new file mode 100644 index 00000000000..f2f16d23618 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/client.go @@ -0,0 +1,26 @@ +package nameavailability + +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 NameAvailabilityClient struct { + Client *resourcemanager.Client +} + +func NewNameAvailabilityClientWithBaseURI(sdkApi sdkEnv.Api) (*NameAvailabilityClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "nameavailability", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating NameAvailabilityClient: %+v", err) + } + + return &NameAvailabilityClient{ + Client: client, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/nameavailability/constants.go b/resource-manager/videoindexer/2025-04-01/nameavailability/constants.go new file mode 100644 index 00000000000..0157fee5d7a --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/constants.go @@ -0,0 +1,86 @@ +package nameavailability + +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 Reason string + +const ( + ReasonAlreadyExists Reason = "AlreadyExists" +) + +func PossibleValuesForReason() []string { + return []string{ + string(ReasonAlreadyExists), + } +} + +func (s *Reason) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseReason(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseReason(input string) (*Reason, error) { + vals := map[string]Reason{ + "alreadyexists": ReasonAlreadyExists, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Reason(input) + return &out, nil +} + +type Type string + +const ( + TypeMicrosoftPointVideoIndexerAccounts Type = "Microsoft.VideoIndexer/accounts" +) + +func PossibleValuesForType() []string { + return []string{ + string(TypeMicrosoftPointVideoIndexerAccounts), + } +} + +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{ + "microsoft.videoindexer/accounts": TypeMicrosoftPointVideoIndexerAccounts, + } + 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/videoindexer/2025-04-01/nameavailability/method_accountschecknameavailability.go b/resource-manager/videoindexer/2025-04-01/nameavailability/method_accountschecknameavailability.go new file mode 100644 index 00000000000..a366d2e1941 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/method_accountschecknameavailability.go @@ -0,0 +1,59 @@ +package nameavailability + +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 AccountsCheckNameAvailabilityOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *CheckNameAvailabilityResult +} + +// AccountsCheckNameAvailability ... +func (c NameAvailabilityClient) AccountsCheckNameAvailability(ctx context.Context, id commonids.SubscriptionId, input AccountCheckNameAvailabilityParameters) (result AccountsCheckNameAvailabilityOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.VideoIndexer/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 + } + + var model CheckNameAvailabilityResult + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/nameavailability/model_accountchecknameavailabilityparameters.go b/resource-manager/videoindexer/2025-04-01/nameavailability/model_accountchecknameavailabilityparameters.go new file mode 100644 index 00000000000..780f5430dc7 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/model_accountchecknameavailabilityparameters.go @@ -0,0 +1,9 @@ +package nameavailability + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AccountCheckNameAvailabilityParameters struct { + Name string `json:"name"` + Type Type `json:"type"` +} diff --git a/resource-manager/videoindexer/2025-04-01/nameavailability/model_checknameavailabilityresult.go b/resource-manager/videoindexer/2025-04-01/nameavailability/model_checknameavailabilityresult.go new file mode 100644 index 00000000000..d8cb431a675 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/model_checknameavailabilityresult.go @@ -0,0 +1,10 @@ +package nameavailability + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CheckNameAvailabilityResult struct { + Message *string `json:"message,omitempty"` + NameAvailable *bool `json:"nameAvailable,omitempty"` + Reason *Reason `json:"reason,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/nameavailability/version.go b/resource-manager/videoindexer/2025-04-01/nameavailability/version.go new file mode 100644 index 00000000000..b8b5b284240 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/nameavailability/version.go @@ -0,0 +1,10 @@ +package nameavailability + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/nameavailability/2025-04-01" +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/README.md b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/README.md new file mode 100644 index 00000000000..bd0193b9f48 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/README.md @@ -0,0 +1,82 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/privateendpointconnections` Documentation + +The `privateendpointconnections` SDK allows for interaction with Azure Resource Manager `videoindexer` (API Version `2025-04-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/videoindexer/2025-04-01/privateendpointconnections" +``` + + +### Client Initialization + +```go +client := privateendpointconnections.NewPrivateEndpointConnectionsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "privateEndpointConnectionName") + +payload := privateendpointconnections.PrivateEndpointConnection{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Delete` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "privateEndpointConnectionName") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `PrivateEndpointConnectionsClient.Get` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "privateEndpointConnectionName") + +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: `PrivateEndpointConnectionsClient.ListByAccount` + +```go +ctx := context.TODO() +id := privateendpointconnections.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +// alternatively `client.ListByAccount(ctx, id)` can be used to do batched pagination +items, err := client.ListByAccountComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/client.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/client.go new file mode 100644 index 00000000000..50eaf09dcce --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/client.go @@ -0,0 +1,26 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient struct { + Client *resourcemanager.Client +} + +func NewPrivateEndpointConnectionsClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateEndpointConnectionsClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privateendpointconnections", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateEndpointConnectionsClient: %+v", err) + } + + return &PrivateEndpointConnectionsClient{ + Client: client, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/constants.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/constants.go new file mode 100644 index 00000000000..c5850609650 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/constants.go @@ -0,0 +1,101 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionProvisioningState string + +const ( + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +func PossibleValuesForPrivateEndpointConnectionProvisioningState() []string { + return []string{ + string(PrivateEndpointConnectionProvisioningStateCreating), + string(PrivateEndpointConnectionProvisioningStateDeleting), + string(PrivateEndpointConnectionProvisioningStateFailed), + string(PrivateEndpointConnectionProvisioningStateSucceeded), + } +} + +func (s *PrivateEndpointConnectionProvisioningState) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointConnectionProvisioningState(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointConnectionProvisioningState(input string) (*PrivateEndpointConnectionProvisioningState, error) { + vals := map[string]PrivateEndpointConnectionProvisioningState{ + "creating": PrivateEndpointConnectionProvisioningStateCreating, + "deleting": PrivateEndpointConnectionProvisioningStateDeleting, + "failed": PrivateEndpointConnectionProvisioningStateFailed, + "succeeded": PrivateEndpointConnectionProvisioningStateSucceeded, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointConnectionProvisioningState(input) + return &out, nil +} + +type PrivateEndpointServiceConnectionStatus string + +const ( + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +func PossibleValuesForPrivateEndpointServiceConnectionStatus() []string { + return []string{ + string(PrivateEndpointServiceConnectionStatusApproved), + string(PrivateEndpointServiceConnectionStatusPending), + string(PrivateEndpointServiceConnectionStatusRejected), + } +} + +func (s *PrivateEndpointServiceConnectionStatus) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parsePrivateEndpointServiceConnectionStatus(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parsePrivateEndpointServiceConnectionStatus(input string) (*PrivateEndpointServiceConnectionStatus, error) { + vals := map[string]PrivateEndpointServiceConnectionStatus{ + "approved": PrivateEndpointServiceConnectionStatusApproved, + "pending": PrivateEndpointServiceConnectionStatusPending, + "rejected": PrivateEndpointServiceConnectionStatusRejected, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := PrivateEndpointServiceConnectionStatus(input) + return &out, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account.go new file mode 100644 index 00000000000..bd77736001a --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account.go @@ -0,0 +1,130 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccountId{}) +} + +var _ resourceids.ResourceId = &AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + return nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account_test.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account_test.go new file mode 100644 index 00000000000..bbd7eea8bc7 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_account_test.go @@ -0,0 +1,282 @@ +package privateendpointconnections + +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 = &AccountId{} + +func TestNewAccountID(t *testing.T) { + id := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } +} + +func TestFormatAccountID(t *testing.T) { + actual := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccountID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestParseAccountIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestSegmentsForAccountId(t *testing.T) { + segments := AccountId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccountId 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/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection.go new file mode 100644 index 00000000000..cc410e5c142 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection.go @@ -0,0 +1,139 @@ +package privateendpointconnections + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&PrivateEndpointConnectionId{}) +} + +var _ resourceids.ResourceId = &PrivateEndpointConnectionId{} + +// PrivateEndpointConnectionId is a struct representing the Resource ID for a Private Endpoint Connection +type PrivateEndpointConnectionId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + PrivateEndpointConnectionName string +} + +// NewPrivateEndpointConnectionID returns a new PrivateEndpointConnectionId struct +func NewPrivateEndpointConnectionID(subscriptionId string, resourceGroupName string, accountName string, privateEndpointConnectionName string) PrivateEndpointConnectionId { + return PrivateEndpointConnectionId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + PrivateEndpointConnectionName: privateEndpointConnectionName, + } +} + +// ParsePrivateEndpointConnectionID parses 'input' into a PrivateEndpointConnectionId +func ParsePrivateEndpointConnectionID(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateEndpointConnectionIDInsensitively parses 'input' case-insensitively into a PrivateEndpointConnectionId +// note: this method should only be used for API response data and not user input +func ParsePrivateEndpointConnectionIDInsensitively(input string) (*PrivateEndpointConnectionId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateEndpointConnectionId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateEndpointConnectionId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateEndpointConnectionId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + if id.PrivateEndpointConnectionName, ok = input.Parsed["privateEndpointConnectionName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "privateEndpointConnectionName", input) + } + + return nil +} + +// ValidatePrivateEndpointConnectionID checks that 'input' can be parsed as a Private Endpoint Connection ID +func ValidatePrivateEndpointConnectionID(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 := ParsePrivateEndpointConnectionID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s/privateEndpointConnections/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.PrivateEndpointConnectionName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + resourceids.StaticSegment("staticPrivateEndpointConnections", "privateEndpointConnections", "privateEndpointConnections"), + resourceids.UserSpecifiedSegment("privateEndpointConnectionName", "privateEndpointConnectionName"), + } +} + +// String returns a human-readable description of this Private Endpoint Connection ID +func (id PrivateEndpointConnectionId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Private Endpoint Connection Name: %q", id.PrivateEndpointConnectionName), + } + return fmt.Sprintf("Private Endpoint Connection (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection_test.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection_test.go new file mode 100644 index 00000000000..989c1d3cc85 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/id_privateendpointconnection_test.go @@ -0,0 +1,327 @@ +package privateendpointconnections + +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 = &PrivateEndpointConnectionId{} + +func TestNewPrivateEndpointConnectionID(t *testing.T) { + id := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "privateEndpointConnectionName") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } + + if id.PrivateEndpointConnectionName != "privateEndpointConnectionName" { + t.Fatalf("Expected %q but got %q for Segment 'PrivateEndpointConnectionName'", id.PrivateEndpointConnectionName, "privateEndpointConnectionName") + } +} + +func TestFormatPrivateEndpointConnectionID(t *testing.T) { + actual := NewPrivateEndpointConnectionID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "privateEndpointConnectionName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections/privateEndpointConnectionName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateEndpointConnectionID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestParsePrivateEndpointConnectionIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateEndpointConnectionId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections/privateEndpointConnectionName", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + PrivateEndpointConnectionName: "privateEndpointConnectionName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateEndpointConnections/privateEndpointConnectionName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + Expected: &PrivateEndpointConnectionId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + PrivateEndpointConnectionName: "pRiVaTeEnDpOiNtCoNnEcTiOnNaMe", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/pRiVaTeEnDpOiNtCoNnEcTiOnS/pRiVaTeEnDpOiNtCoNnEcTiOnNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateEndpointConnectionIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + if actual.PrivateEndpointConnectionName != v.Expected.PrivateEndpointConnectionName { + t.Fatalf("Expected %q but got %q for PrivateEndpointConnectionName", v.Expected.PrivateEndpointConnectionName, actual.PrivateEndpointConnectionName) + } + + } +} + +func TestSegmentsForPrivateEndpointConnectionId(t *testing.T) { + segments := PrivateEndpointConnectionId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateEndpointConnectionId 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/videoindexer/2025-04-01/privateendpointconnections/method_createorupdate.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_createorupdate.go new file mode 100644 index 00000000000..73fb1683a66 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_createorupdate.go @@ -0,0 +1,75 @@ +package privateendpointconnections + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData + Model *PrivateEndpointConnection +} + +// CreateOrUpdate ... +func (c PrivateEndpointConnectionsClient) CreateOrUpdate(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) (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 PrivateEndpointConnectionsClient) CreateOrUpdateThenPoll(ctx context.Context, id PrivateEndpointConnectionId, input PrivateEndpointConnection) 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/videoindexer/2025-04-01/privateendpointconnections/method_delete.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_delete.go new file mode 100644 index 00000000000..c80136ed33a --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_delete.go @@ -0,0 +1,70 @@ +package privateendpointconnections + +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 PrivateEndpointConnectionsClient) Delete(ctx context.Context, id PrivateEndpointConnectionId) (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 PrivateEndpointConnectionsClient) DeleteThenPoll(ctx context.Context, id PrivateEndpointConnectionId) 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/videoindexer/2025-04-01/privateendpointconnections/method_get.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_get.go new file mode 100644 index 00000000000..351242746d4 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_get.go @@ -0,0 +1,53 @@ +package privateendpointconnections + +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 *PrivateEndpointConnection +} + +// Get ... +func (c PrivateEndpointConnectionsClient) Get(ctx context.Context, id PrivateEndpointConnectionId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model PrivateEndpointConnection + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_listbyaccount.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_listbyaccount.go new file mode 100644 index 00000000000..bbfaec44b3e --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/method_listbyaccount.go @@ -0,0 +1,105 @@ +package privateendpointconnections + +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 ListByAccountOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PrivateEndpointConnection +} + +type ListByAccountCompleteResult struct { + LatestHttpResponse *http.Response + Items []PrivateEndpointConnection +} + +type ListByAccountCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByAccountCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByAccount ... +func (c PrivateEndpointConnectionsClient) ListByAccount(ctx context.Context, id AccountId) (result ListByAccountOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByAccountCustomPager{}, + Path: fmt.Sprintf("%s/privateEndpointConnections", 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 *[]PrivateEndpointConnection `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByAccountComplete retrieves all the results into a single object +func (c PrivateEndpointConnectionsClient) ListByAccountComplete(ctx context.Context, id AccountId) (ListByAccountCompleteResult, error) { + return c.ListByAccountCompleteMatchingPredicate(ctx, id, PrivateEndpointConnectionOperationPredicate{}) +} + +// ListByAccountCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateEndpointConnectionsClient) ListByAccountCompleteMatchingPredicate(ctx context.Context, id AccountId, predicate PrivateEndpointConnectionOperationPredicate) (result ListByAccountCompleteResult, err error) { + items := make([]PrivateEndpointConnection, 0) + + resp, err := c.ListByAccount(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByAccountCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpoint.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpoint.go new file mode 100644 index 00000000000..1bc8cf2a97c --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpoint.go @@ -0,0 +1,8 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnection.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnection.go new file mode 100644 index 00000000000..977fe056fe3 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnection.go @@ -0,0 +1,16 @@ +package privateendpointconnections + +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 PrivateEndpointConnection struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnectionproperties.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnectionproperties.go new file mode 100644 index 00000000000..fb540c904b6 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privateendpointconnectionproperties.go @@ -0,0 +1,11 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionProperties struct { + GroupIds *[]string `json:"groupIds,omitempty"` + PrivateEndpoint *PrivateEndpoint `json:"privateEndpoint,omitempty"` + PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState `json:"privateLinkServiceConnectionState"` + ProvisioningState *PrivateEndpointConnectionProvisioningState `json:"provisioningState,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go new file mode 100644 index 00000000000..ec3f7a9f24c --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/model_privatelinkserviceconnectionstate.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkServiceConnectionState struct { + ActionsRequired *string `json:"actionsRequired,omitempty"` + Description *string `json:"description,omitempty"` + Status *PrivateEndpointServiceConnectionStatus `json:"status,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/privateendpointconnections/predicates.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/predicates.go new file mode 100644 index 00000000000..4a03a91ce52 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/predicates.go @@ -0,0 +1,27 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateEndpointConnectionOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateEndpointConnectionOperationPredicate) Matches(input PrivateEndpointConnection) 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/videoindexer/2025-04-01/privateendpointconnections/version.go b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/version.go new file mode 100644 index 00000000000..4975b737870 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privateendpointconnections/version.go @@ -0,0 +1,10 @@ +package privateendpointconnections + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/privateendpointconnections/2025-04-01" +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/README.md b/resource-manager/videoindexer/2025-04-01/privatelinkresources/README.md new file mode 100644 index 00000000000..2609bfbf633 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/videoindexer/2025-04-01/privatelinkresources` Documentation + +The `privatelinkresources` SDK allows for interaction with Azure Resource Manager `videoindexer` (API Version `2025-04-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/videoindexer/2025-04-01/privatelinkresources" +``` + + +### Client Initialization + +```go +client := privatelinkresources.NewPrivateLinkResourcesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `PrivateLinkResourcesClient.Get` + +```go +ctx := context.TODO() +id := privatelinkresources.NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "groupId") + +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: `PrivateLinkResourcesClient.ListByAccount` + +```go +ctx := context.TODO() +id := privatelinkresources.NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + +// alternatively `client.ListByAccount(ctx, id)` can be used to do batched pagination +items, err := client.ListByAccountComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/client.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/client.go new file mode 100644 index 00000000000..28c00b21f03 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/client.go @@ -0,0 +1,26 @@ +package privatelinkresources + +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 PrivateLinkResourcesClient struct { + Client *resourcemanager.Client +} + +func NewPrivateLinkResourcesClientWithBaseURI(sdkApi sdkEnv.Api) (*PrivateLinkResourcesClient, error) { + client, err := resourcemanager.NewClient(sdkApi, "privatelinkresources", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating PrivateLinkResourcesClient: %+v", err) + } + + return &PrivateLinkResourcesClient{ + Client: client, + }, nil +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account.go new file mode 100644 index 00000000000..2d398309d16 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account.go @@ -0,0 +1,130 @@ +package privatelinkresources + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&AccountId{}) +} + +var _ resourceids.ResourceId = &AccountId{} + +// AccountId is a struct representing the Resource ID for a Account +type AccountId struct { + SubscriptionId string + ResourceGroupName string + AccountName string +} + +// NewAccountID returns a new AccountId struct +func NewAccountID(subscriptionId string, resourceGroupName string, accountName string) AccountId { + return AccountId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + } +} + +// ParseAccountID parses 'input' into a AccountId +func ParseAccountID(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseAccountIDInsensitively parses 'input' case-insensitively into a AccountId +// note: this method should only be used for API response data and not user input +func ParseAccountIDInsensitively(input string) (*AccountId, error) { + parser := resourceids.NewParserFromResourceIdType(&AccountId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := AccountId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *AccountId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + return nil +} + +// ValidateAccountID checks that 'input' can be parsed as a Account ID +func ValidateAccountID(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 := ParseAccountID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Account ID +func (id AccountId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Account ID +func (id AccountId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + } +} + +// String returns a human-readable description of this Account ID +func (id AccountId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + } + return fmt.Sprintf("Account (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account_test.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account_test.go new file mode 100644 index 00000000000..363080add36 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_account_test.go @@ -0,0 +1,282 @@ +package privatelinkresources + +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 = &AccountId{} + +func TestNewAccountID(t *testing.T) { + id := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } +} + +func TestFormatAccountID(t *testing.T) { + actual := NewAccountID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParseAccountID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestParseAccountIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *AccountId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Expected: &AccountId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParseAccountIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + } +} + +func TestSegmentsForAccountId(t *testing.T) { + segments := AccountId{}.Segments() + if len(segments) == 0 { + t.Fatalf("AccountId 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/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource.go new file mode 100644 index 00000000000..f1ef0640a97 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource.go @@ -0,0 +1,139 @@ +package privatelinkresources + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/recaser" + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +func init() { + recaser.RegisterResourceId(&PrivateLinkResourceId{}) +} + +var _ resourceids.ResourceId = &PrivateLinkResourceId{} + +// PrivateLinkResourceId is a struct representing the Resource ID for a Private Link Resource +type PrivateLinkResourceId struct { + SubscriptionId string + ResourceGroupName string + AccountName string + GroupId string +} + +// NewPrivateLinkResourceID returns a new PrivateLinkResourceId struct +func NewPrivateLinkResourceID(subscriptionId string, resourceGroupName string, accountName string, groupId string) PrivateLinkResourceId { + return PrivateLinkResourceId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AccountName: accountName, + GroupId: groupId, + } +} + +// ParsePrivateLinkResourceID parses 'input' into a PrivateLinkResourceId +func ParsePrivateLinkResourceID(input string) (*PrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateLinkResourceId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateLinkResourceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParsePrivateLinkResourceIDInsensitively parses 'input' case-insensitively into a PrivateLinkResourceId +// note: this method should only be used for API response data and not user input +func ParsePrivateLinkResourceIDInsensitively(input string) (*PrivateLinkResourceId, error) { + parser := resourceids.NewParserFromResourceIdType(&PrivateLinkResourceId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := PrivateLinkResourceId{} + if err = id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *PrivateLinkResourceId) 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.AccountName, ok = input.Parsed["accountName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "accountName", input) + } + + if id.GroupId, ok = input.Parsed["groupId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "groupId", input) + } + + return nil +} + +// ValidatePrivateLinkResourceID checks that 'input' can be parsed as a Private Link Resource ID +func ValidatePrivateLinkResourceID(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 := ParsePrivateLinkResourceID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Private Link Resource ID +func (id PrivateLinkResourceId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.VideoIndexer/accounts/%s/privateLinkResources/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AccountName, id.GroupId) +} + +// Segments returns a slice of Resource ID Segments which comprise this Private Link Resource ID +func (id PrivateLinkResourceId) 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("staticMicrosoftVideoIndexer", "Microsoft.VideoIndexer", "Microsoft.VideoIndexer"), + resourceids.StaticSegment("staticAccounts", "accounts", "accounts"), + resourceids.UserSpecifiedSegment("accountName", "accountName"), + resourceids.StaticSegment("staticPrivateLinkResources", "privateLinkResources", "privateLinkResources"), + resourceids.UserSpecifiedSegment("groupId", "groupId"), + } +} + +// String returns a human-readable description of this Private Link Resource ID +func (id PrivateLinkResourceId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Account Name: %q", id.AccountName), + fmt.Sprintf("Group: %q", id.GroupId), + } + return fmt.Sprintf("Private Link Resource (%s)", strings.Join(components, "\n")) +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource_test.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource_test.go new file mode 100644 index 00000000000..bc41ae1a8c3 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/id_privatelinkresource_test.go @@ -0,0 +1,327 @@ +package privatelinkresources + +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 = &PrivateLinkResourceId{} + +func TestNewPrivateLinkResourceID(t *testing.T) { + id := NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "groupId") + + 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.AccountName != "accountName" { + t.Fatalf("Expected %q but got %q for Segment 'AccountName'", id.AccountName, "accountName") + } + + if id.GroupId != "groupId" { + t.Fatalf("Expected %q but got %q for Segment 'GroupId'", id.GroupId, "groupId") + } +} + +func TestFormatPrivateLinkResourceID(t *testing.T) { + actual := NewPrivateLinkResourceID("12345678-1234-9876-4563-123456789012", "example-resource-group", "accountName", "groupId").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources/groupId" + if actual != expected { + t.Fatalf("Expected the Formatted ID to be %q but got %q", expected, actual) + } +} + +func TestParsePrivateLinkResourceID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateLinkResourceId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources/groupId", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + GroupId: "groupId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources/groupId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateLinkResourceID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + if actual.GroupId != v.Expected.GroupId { + t.Fatalf("Expected %q but got %q for GroupId", v.Expected.GroupId, actual.GroupId) + } + + } +} + +func TestParsePrivateLinkResourceIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *PrivateLinkResourceId + }{ + { + // 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.VideoIndexer", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe", + Error: true, + }, + { + // Incomplete URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources", + Error: true, + }, + { + // Incomplete URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/pRiVaTeLiNkReSoUrCeS", + Error: true, + }, + { + // Valid URI + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources/groupId", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "example-resource-group", + AccountName: "accountName", + GroupId: "groupId", + }, + }, + { + // Invalid (Valid Uri with Extra segment) + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/example-resource-group/providers/Microsoft.VideoIndexer/accounts/accountName/privateLinkResources/groupId/extra", + Error: true, + }, + { + // Valid URI (mIxEd CaSe since this is insensitive) + Input: "/sUbScRiPtIoNs/12345678-1234-9876-4563-123456789012/rEsOuRcEgRoUpS/eXaMpLe-rEsOuRcE-GrOuP/pRoViDeRs/mIcRoSoFt.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/pRiVaTeLiNkReSoUrCeS/gRoUpId", + Expected: &PrivateLinkResourceId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroupName: "eXaMpLe-rEsOuRcE-GrOuP", + AccountName: "aCcOuNtNaMe", + GroupId: "gRoUpId", + }, + }, + { + // 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.vIdEoInDeXeR/aCcOuNtS/aCcOuNtNaMe/pRiVaTeLiNkReSoUrCeS/gRoUpId/extra", + Error: true, + }, + } + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := ParsePrivateLinkResourceIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %+v", err) + } + if v.Error { + t.Fatal("Expect an error but didn't 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.AccountName != v.Expected.AccountName { + t.Fatalf("Expected %q but got %q for AccountName", v.Expected.AccountName, actual.AccountName) + } + + if actual.GroupId != v.Expected.GroupId { + t.Fatalf("Expected %q but got %q for GroupId", v.Expected.GroupId, actual.GroupId) + } + + } +} + +func TestSegmentsForPrivateLinkResourceId(t *testing.T) { + segments := PrivateLinkResourceId{}.Segments() + if len(segments) == 0 { + t.Fatalf("PrivateLinkResourceId 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/videoindexer/2025-04-01/privatelinkresources/method_get.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/method_get.go new file mode 100644 index 00000000000..4fe26146181 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/method_get.go @@ -0,0 +1,53 @@ +package privatelinkresources + +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 *PrivateLinkResource +} + +// Get ... +func (c PrivateLinkResourcesClient) Get(ctx context.Context, id PrivateLinkResourceId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + var model PrivateLinkResource + result.Model = &model + if err = resp.Unmarshal(result.Model); err != nil { + return + } + + return +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/method_listbyaccount.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/method_listbyaccount.go new file mode 100644 index 00000000000..f6f5a7d2412 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/method_listbyaccount.go @@ -0,0 +1,105 @@ +package privatelinkresources + +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 ListByAccountOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]PrivateLinkResource +} + +type ListByAccountCompleteResult struct { + LatestHttpResponse *http.Response + Items []PrivateLinkResource +} + +type ListByAccountCustomPager struct { + NextLink *odata.Link `json:"nextLink"` +} + +func (p *ListByAccountCustomPager) NextPageLink() *odata.Link { + defer func() { + p.NextLink = nil + }() + + return p.NextLink +} + +// ListByAccount ... +func (c PrivateLinkResourcesClient) ListByAccount(ctx context.Context, id AccountId) (result ListByAccountOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Pager: &ListByAccountCustomPager{}, + Path: fmt.Sprintf("%s/privateLinkResources", 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 *[]PrivateLinkResource `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByAccountComplete retrieves all the results into a single object +func (c PrivateLinkResourcesClient) ListByAccountComplete(ctx context.Context, id AccountId) (ListByAccountCompleteResult, error) { + return c.ListByAccountCompleteMatchingPredicate(ctx, id, PrivateLinkResourceOperationPredicate{}) +} + +// ListByAccountCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c PrivateLinkResourcesClient) ListByAccountCompleteMatchingPredicate(ctx context.Context, id AccountId, predicate PrivateLinkResourceOperationPredicate) (result ListByAccountCompleteResult, err error) { + items := make([]PrivateLinkResource, 0) + + resp, err := c.ListByAccount(ctx, id) + if err != nil { + result.LatestHttpResponse = resp.HttpResponse + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByAccountCompleteResult{ + LatestHttpResponse: resp.HttpResponse, + Items: items, + } + return +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresource.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresource.go new file mode 100644 index 00000000000..6e8c3d8148b --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresource.go @@ -0,0 +1,16 @@ +package privatelinkresources + +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 PrivateLinkResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *PrivateLinkResourceProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresourceproperties.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresourceproperties.go new file mode 100644 index 00000000000..3c98012cdd1 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/model_privatelinkresourceproperties.go @@ -0,0 +1,10 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourceProperties struct { + GroupId *string `json:"groupId,omitempty"` + RequiredMembers *[]string `json:"requiredMembers,omitempty"` + RequiredZoneNames *[]string `json:"requiredZoneNames,omitempty"` +} diff --git a/resource-manager/videoindexer/2025-04-01/privatelinkresources/predicates.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/predicates.go new file mode 100644 index 00000000000..19b771c3994 --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/predicates.go @@ -0,0 +1,27 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type PrivateLinkResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p PrivateLinkResourceOperationPredicate) Matches(input PrivateLinkResource) 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/videoindexer/2025-04-01/privatelinkresources/version.go b/resource-manager/videoindexer/2025-04-01/privatelinkresources/version.go new file mode 100644 index 00000000000..3ff5793be0d --- /dev/null +++ b/resource-manager/videoindexer/2025-04-01/privatelinkresources/version.go @@ -0,0 +1,10 @@ +package privatelinkresources + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2025-04-01" + +func userAgent() string { + return "hashicorp/go-azure-sdk/privatelinkresources/2025-04-01" +}