From 68c3895670c6f50517bd7654abf4bb6f501d6739 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Thu, 23 Nov 2023 20:46:38 +0800 Subject: [PATCH 01/17] New Resource: azurerm_system_center_virtual_machine_manager_server --- .github/labeler-issue-triage.yml | 3 + .github/labeler-pull-request-triage.yml | 3 + .teamcity/components/generated/services.kt | 1 + internal/clients/client.go | 250 +++++----- internal/provider/services.go | 2 + .../client/client.go | 20 + .../registration.go | 35 ++ ...virtual_machine_manager_server_resource.go | 306 ++++++++++++ ...al_machine_manager_server_resource_test.go | 190 ++++++++ ...ter_virtual_machine_manager_server_name.go | 20 + ...irtual_machine_manager_server_name_test.go | 58 +++ .../2023-10-07/availabilitysets/README.md | 116 +++++ .../2023-10-07/availabilitysets/client.go | 26 ++ .../2023-10-07/availabilitysets/constants.go | 110 +++++ .../availabilitysets/id_availabilityset.go | 127 +++++ .../availabilitysets/method_createorupdate.go | 74 +++ .../availabilitysets/method_delete.go | 98 ++++ .../2023-10-07/availabilitysets/method_get.go | 51 ++ .../method_listbyresourcegroup.go | 90 ++++ .../method_listbysubscription.go | 90 ++++ .../availabilitysets/method_update.go | 74 +++ .../availabilitysets/model_availabilityset.go | 19 + .../model_availabilitysetproperties.go | 10 + .../model_extendedlocation.go | 9 + .../availabilitysets/model_resourcepatch.go | 8 + .../2023-10-07/availabilitysets/predicates.go | 32 ++ .../2023-10-07/availabilitysets/version.go | 12 + .../2023-10-07/client.go | 100 ++++ .../2023-10-07/clouds/README.md | 116 +++++ .../2023-10-07/clouds/client.go | 26 ++ .../2023-10-07/clouds/constants.go | 110 +++++ .../2023-10-07/clouds/id_cloud.go | 127 +++++ .../clouds/method_createorupdate.go | 74 +++ .../2023-10-07/clouds/method_delete.go | 98 ++++ .../2023-10-07/clouds/method_get.go | 51 ++ .../clouds/method_listbyresourcegroup.go | 90 ++++ .../clouds/method_listbysubscription.go | 90 ++++ .../2023-10-07/clouds/method_update.go | 74 +++ .../2023-10-07/clouds/model_cloud.go | 19 + .../2023-10-07/clouds/model_cloudcapacity.go | 10 + .../clouds/model_cloudproperties.go | 14 + .../clouds/model_extendedlocation.go | 9 + .../2023-10-07/clouds/model_resourcepatch.go | 8 + .../clouds/model_storageqospolicy.go | 13 + .../2023-10-07/clouds/predicates.go | 32 ++ .../2023-10-07/clouds/version.go | 12 + .../2023-10-07/inventoryitems/README.md | 90 ++++ .../2023-10-07/inventoryitems/client.go | 26 ++ .../2023-10-07/inventoryitems/constants.go | 160 +++++++ .../inventoryitems/id_inventoryitem.go | 140 ++++++ .../2023-10-07/inventoryitems/id_vmmserver.go | 127 +++++ .../inventoryitems/method_create.go | 56 +++ .../inventoryitems/method_delete.go | 47 ++ .../2023-10-07/inventoryitems/method_get.go | 51 ++ .../inventoryitems/method_listbyvmmserver.go | 89 ++++ .../model_cloudinventoryitem.go | 44 ++ .../inventoryitems/model_inventoryitem.go | 50 ++ .../model_inventoryitemdetails.go | 9 + .../model_inventoryitemproperties.go | 77 +++ .../model_virtualmachineinventoryitem.go | 52 +++ ...del_virtualmachinetemplateinventoryitem.go | 48 ++ .../model_virtualnetworkinventoryitem.go | 44 ++ .../2023-10-07/inventoryitems/predicates.go | 32 ++ .../2023-10-07/inventoryitems/version.go | 12 + .../virtualmachineinstances/README.md | 191 ++++++++ .../virtualmachineinstances/client.go | 26 ++ .../virtualmachineinstances/constants.go | 441 ++++++++++++++++++ .../method_createcheckpoint.go | 74 +++ .../method_createorupdate.go | 75 +++ .../virtualmachineinstances/method_delete.go | 103 ++++ .../method_deletecheckpoint.go | 74 +++ .../virtualmachineinstances/method_get.go | 53 +++ .../virtualmachineinstances/method_list.go | 90 ++++ .../virtualmachineinstances/method_restart.go | 70 +++ .../method_restorecheckpoint.go | 74 +++ .../virtualmachineinstances/method_start.go | 70 +++ .../virtualmachineinstances/method_stop.go | 74 +++ .../virtualmachineinstances/method_update.go | 75 +++ ...ilabilitysetlistavailabilitysetsinlined.go | 9 + .../model_checkpoint.go | 11 + .../model_extendedlocation.go | 9 + .../model_hardwareprofile.go | 14 + .../model_hardwareprofileupdate.go | 13 + .../model_infrastructureprofile.go | 18 + .../model_infrastructureprofileupdate.go | 8 + .../model_networkinterface.go | 18 + .../model_networkinterfaceupdate.go | 14 + .../model_networkprofile.go | 8 + .../model_networkprofileupdate.go | 8 + .../model_osprofileforvminstance.go | 12 + .../model_stopvirtualmachineoptions.go | 8 + .../model_storageprofile.go | 8 + .../model_storageprofileupdate.go | 8 + .../model_storageqospolicydetails.go | 9 + .../model_virtualdisk.go | 21 + .../model_virtualdiskupdate.go | 15 + .../model_virtualmachinecreatecheckpoint.go | 9 + .../model_virtualmachinedeletecheckpoint.go | 8 + .../model_virtualmachineinstance.go | 17 + .../model_virtualmachineinstanceproperties.go | 15 + .../model_virtualmachineinstanceupdate.go | 8 + ..._virtualmachineinstanceupdateproperties.go | 12 + .../model_virtualmachinerestorecheckpoint.go | 8 + .../virtualmachineinstances/predicates.go | 27 ++ .../virtualmachineinstances/version.go | 12 + .../virtualmachinetemplates/README.md | 116 +++++ .../virtualmachinetemplates/client.go | 26 ++ .../virtualmachinetemplates/constants.go | 400 ++++++++++++++++ .../id_virtualmachinetemplate.go | 127 +++++ .../method_createorupdate.go | 74 +++ .../virtualmachinetemplates/method_delete.go | 98 ++++ .../virtualmachinetemplates/method_get.go | 51 ++ .../method_listbyresourcegroup.go | 90 ++++ .../method_listbysubscription.go | 90 ++++ .../virtualmachinetemplates/method_update.go | 74 +++ .../model_extendedlocation.go | 9 + .../model_networkinterface.go | 18 + .../model_resourcepatch.go | 8 + .../model_storageqospolicydetails.go | 9 + .../model_virtualdisk.go | 21 + .../model_virtualmachinetemplate.go | 19 + .../model_virtualmachinetemplateproperties.go | 25 + .../virtualmachinetemplates/predicates.go | 32 ++ .../virtualmachinetemplates/version.go | 12 + .../2023-10-07/virtualnetworks/README.md | 116 +++++ .../2023-10-07/virtualnetworks/client.go | 26 ++ .../2023-10-07/virtualnetworks/constants.go | 110 +++++ .../virtualnetworks/id_virtualnetwork.go | 127 +++++ .../virtualnetworks/method_createorupdate.go | 74 +++ .../virtualnetworks/method_delete.go | 98 ++++ .../2023-10-07/virtualnetworks/method_get.go | 51 ++ .../method_listbyresourcegroup.go | 90 ++++ .../method_listbysubscription.go | 90 ++++ .../virtualnetworks/method_update.go | 74 +++ .../virtualnetworks/model_extendedlocation.go | 9 + .../virtualnetworks/model_resourcepatch.go | 8 + .../virtualnetworks/model_virtualnetwork.go | 19 + .../model_virtualnetworkproperties.go | 12 + .../2023-10-07/virtualnetworks/predicates.go | 32 ++ .../2023-10-07/virtualnetworks/version.go | 12 + .../vminstanceguestagents/README.md | 86 ++++ .../vminstanceguestagents/client.go | 26 ++ .../vminstanceguestagents/constants.go | 113 +++++ .../vminstanceguestagents/method_create.go | 75 +++ .../vminstanceguestagents/method_delete.go | 49 ++ .../vminstanceguestagents/method_get.go | 53 +++ .../vminstanceguestagents/method_list.go | 90 ++++ .../vminstanceguestagents/model_guestagent.go | 16 + .../model_guestagentproperties.go | 14 + .../model_guestcredential.go | 9 + .../model_httpproxyconfiguration.go | 8 + .../vminstanceguestagents/predicates.go | 27 ++ .../vminstanceguestagents/version.go | 12 + .../README.md | 53 +++ .../client.go | 26 ++ .../constants.go | 69 +++ ...achineinstancehybrididentitymetadataget.go | 53 +++ ...chineinstancehybrididentitymetadatalist.go | 90 ++++ .../model_vminstancehybrididentitymetadata.go | 16 + ...nstancehybrididentitymetadataproperties.go | 10 + .../predicates.go | 27 ++ .../version.go | 12 + .../2023-10-07/vmmservers/README.md | 116 +++++ .../2023-10-07/vmmservers/client.go | 26 ++ .../2023-10-07/vmmservers/constants.go | 110 +++++ .../2023-10-07/vmmservers/id_vmmserver.go | 127 +++++ .../vmmservers/method_createorupdate.go | 74 +++ .../2023-10-07/vmmservers/method_delete.go | 98 ++++ .../2023-10-07/vmmservers/method_get.go | 51 ++ .../vmmservers/method_listbyresourcegroup.go | 90 ++++ .../vmmservers/method_listbysubscription.go | 90 ++++ .../2023-10-07/vmmservers/method_update.go | 74 +++ .../vmmservers/model_extendedlocation.go | 9 + .../vmmservers/model_resourcepatch.go | 8 + .../vmmservers/model_vmmcredential.go | 9 + .../2023-10-07/vmmservers/model_vmmserver.go | 19 + .../vmmservers/model_vmmserverproperties.go | 15 + .../2023-10-07/vmmservers/predicates.go | 32 ++ .../2023-10-07/vmmservers/version.go | 12 + vendor/modules.txt | 10 + website/allowed-subcategories | 1 + ...rtual_machine_manager_server.html.markdown | 85 ++++ 182 files changed, 9993 insertions(+), 122 deletions(-) create mode 100644 internal/services/systemcentervirtualmachinemanager/client/client.go create mode 100644 internal/services/systemcentervirtualmachinemanager/registration.go create mode 100644 internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go create mode 100644 internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go create mode 100644 internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go create mode 100644 internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go create mode 100644 website/docs/r/system_center_virtual_machine_manager_server.html.markdown diff --git a/.github/labeler-issue-triage.yml b/.github/labeler-issue-triage.yml index ab3c8e3cd5c9..76b7dc29a532 100644 --- a/.github/labeler-issue-triage.yml +++ b/.github/labeler-issue-triage.yml @@ -339,6 +339,9 @@ service/subscription: service/synapse: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_synapse_((.|\n)*)###' +service/systemcentervirtualmachinemanager: + - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_system_center_virtual_machine_manager_server((.|\n)*)###' + service/traffic-manager: - '### (|New or )Affected Resource\(s\)\/Data Source\(s\)((.|\n)*)azurerm_traffic_manager_((.|\n)*)###' diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index bb6a4aa0650c..0f292e4dc12c 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -342,6 +342,9 @@ service/subscription: service/synapse: - internal/services/synapse/**/* +service/systemcentervirtualmachinemanager: + - internal/services/systemcentervirtualmachinemanager/**/* + service/traffic-manager: - internal/services/trafficmanager/**/* diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index 345efa5d02bd..4b492cd9be78 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -123,6 +123,7 @@ var services = mapOf( "streamanalytics" to "Stream Analytics", "subscription" to "Subscription", "synapse" to "Synapse", + "systemcentervirtualmachinemanager" to "System Center Virtual Machine Manager", "iottimeseriesinsights" to "Time Series Insights", "trafficmanager" to "Traffic Manager", "vmware" to "VMware", diff --git a/internal/clients/client.go b/internal/clients/client.go index 428dd878ac81..6ca050227ede 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -20,6 +20,7 @@ import ( redis_v2023_04_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2023-04-01" servicenetworking_v2023_05_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview" storagecache_2023_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01" + systemcentervirtualmachinemanager_2023_10_07 "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07" timeseriesinsights_v2020_05_15 "github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" @@ -140,6 +141,7 @@ import ( streamAnalytics "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics/client" subscription "github.com/hashicorp/terraform-provider-azurerm/internal/services/subscription/client" synapse "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse/client" + systemCenterVirtualMachineManager "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/client" trafficManager "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager/client" videoAnalyzer "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer/client" vmware "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware/client" @@ -156,128 +158,129 @@ type Client struct { Account *ResourceManagerAccount Features features.UserFeatures - AadB2c *aadb2c_v2021_04_01_preview.Client - Advisor *advisor.Client - AnalysisServices *analysisservices_v2017_08_01.Client - ApiManagement *apiManagement.Client - AppConfiguration *appConfiguration.Client - AppInsights *applicationInsights.Client - AppPlatform *appPlatform.Client - AppService *appService.Client - ArcKubernetes *arckubernetes.Client - ArcResourceBridge *arcResourceBridge.Client - Attestation *attestation.Client - Authorization *authorization.Client - Automanage *automanage.Client - Automation *automation.Client - AzureManagedLustreFileSystem *storagecache_2023_05_01.Client - AzureStackHCI *azurestackhci_v2023_03_01.Client - Batch *batch.Client - Blueprints *blueprints.Client - Bot *bot.Client - Cdn *cdn.Client - Cognitive *cognitiveServices.Client - Communication *communication.Client - Compute *compute.Client - ConfidentialLedger *confidentialledger.Client - Connections *connections.Client - Consumption *consumption.Client - ContainerApps *containerapps.Client - Containers *containerServices.Client - Cosmos *cosmosdb.Client - CostManagement *costmanagement.Client - CustomProviders *customproviders.Client - Dashboard *dashboard.Client - DatabaseMigration *datamigration.Client - DataBricks *databricks.Client - DataboxEdge *databoxedge.Client - Datadog *datadog_v2021_03_01.Client - DataFactory *datafactory.Client - DataProtection *dataprotection.Client - DataShare *datashare.Client - DesktopVirtualization *desktopvirtualization.Client - DevTestLabs *devtestlabs.Client - DigitalTwins *digitaltwins.Client - Disks *disks.Client - Dns *dns_v2018_05_01.Client - DomainServices *domainservices.Client - Elastic *elastic.Client - EventGrid *eventgrid_v2022_06_15.Client - Eventhub *eventhub.Client - Firewall *firewall.Client - FluidRelay *fluidrelay_2022_05_26.Client - Frontdoor *frontdoor.Client - Graph *graph.Client - HPCCache *hpccache.Client - HSM *hsm.Client - HDInsight *hdinsight.Client - HybridCompute *hybridcompute.Client - HealthCare *healthcare.Client - IoTCentral *iotcentral.Client - IoTHub *iothub.Client - IoTTimeSeriesInsights *timeseriesinsights_v2020_05_15.Client - KeyVault *keyvault.Client - Kusto *kusto.Client - LabService *labservice.Client - Legacy *legacy.Client - Lighthouse *lighthouse.Client - LoadBalancers *loadbalancers.Client - LogAnalytics *loganalytics.Client - Logic *logic.Client - Logz *logz.Client - MachineLearning *machinelearning.Client - Maintenance *maintenance.Client - ManagedApplication *managedapplication.Client - ManagementGroups *managementgroup.Client - Maps *maps.Client - MariaDB *mariadb.Client - Media *media.Client - MixedReality *mixedreality.Client - Monitor *monitor.Client - MobileNetwork *mobilenetwork.Client - MSSQL *mssql.Client - MSSQLManagedInstance *mssqlmanagedinstance.Client - MySQL *mysql.Client - NetApp *netapp.Client - Network *network.Client - NetworkFunction *networkfunction.Client - NewRelic *newrelic.Client - Nginx *nginx2.Client - NotificationHubs *notificationhub.Client - Orbital *orbital.Client - PaloAlto *paloalto.Client - Policy *policy.Client - Portal *portal.Client - Postgres *postgres.Client - PowerBI *powerBI.Client - PrivateDns *privatedns.Client - PrivateDnsResolver *dnsresolver.Client - Purview *purview.Client - RecoveryServices *recoveryServices.Client - Redis *redis_v2023_04_01.Client - RedisEnterprise *redisenterprise.Client - Relay *relay.Client - Resource *resource.Client - Search *search.Client - SecurityCenter *securityCenter.Client - Sentinel *sentinel.Client - ServiceBus *serviceBus.Client - ServiceConnector *serviceConnector.Client - ServiceFabric *serviceFabric.Client - ServiceFabricManaged *serviceFabricManaged.Client - ServiceNetworking *servicenetworking_v2023_05_01_preview.Client - SignalR *signalr.Client - Storage *storage.Client - StorageMover *storageMover.Client - StreamAnalytics *streamAnalytics.Client - Subscription *subscription.Client - Sql *sql.Client - Synapse *synapse.Client - TrafficManager *trafficManager.Client - VideoAnalyzer *videoAnalyzer.Client - Vmware *vmware.Client - VoiceServices *voiceServices.Client - Web *web.Client + AadB2c *aadb2c_v2021_04_01_preview.Client + Advisor *advisor.Client + AnalysisServices *analysisservices_v2017_08_01.Client + ApiManagement *apiManagement.Client + AppConfiguration *appConfiguration.Client + AppInsights *applicationInsights.Client + AppPlatform *appPlatform.Client + AppService *appService.Client + ArcKubernetes *arckubernetes.Client + ArcResourceBridge *arcResourceBridge.Client + Attestation *attestation.Client + Authorization *authorization.Client + Automanage *automanage.Client + Automation *automation.Client + AzureManagedLustreFileSystem *storagecache_2023_05_01.Client + AzureStackHCI *azurestackhci_v2023_03_01.Client + Batch *batch.Client + Blueprints *blueprints.Client + Bot *bot.Client + Cdn *cdn.Client + Cognitive *cognitiveServices.Client + Communication *communication.Client + Compute *compute.Client + ConfidentialLedger *confidentialledger.Client + Connections *connections.Client + Consumption *consumption.Client + ContainerApps *containerapps.Client + Containers *containerServices.Client + Cosmos *cosmosdb.Client + CostManagement *costmanagement.Client + CustomProviders *customproviders.Client + Dashboard *dashboard.Client + DatabaseMigration *datamigration.Client + DataBricks *databricks.Client + DataboxEdge *databoxedge.Client + Datadog *datadog_v2021_03_01.Client + DataFactory *datafactory.Client + DataProtection *dataprotection.Client + DataShare *datashare.Client + DesktopVirtualization *desktopvirtualization.Client + DevTestLabs *devtestlabs.Client + DigitalTwins *digitaltwins.Client + Disks *disks.Client + Dns *dns_v2018_05_01.Client + DomainServices *domainservices.Client + Elastic *elastic.Client + EventGrid *eventgrid_v2022_06_15.Client + Eventhub *eventhub.Client + Firewall *firewall.Client + FluidRelay *fluidrelay_2022_05_26.Client + Frontdoor *frontdoor.Client + Graph *graph.Client + HPCCache *hpccache.Client + HSM *hsm.Client + HDInsight *hdinsight.Client + HybridCompute *hybridcompute.Client + HealthCare *healthcare.Client + IoTCentral *iotcentral.Client + IoTHub *iothub.Client + IoTTimeSeriesInsights *timeseriesinsights_v2020_05_15.Client + KeyVault *keyvault.Client + Kusto *kusto.Client + LabService *labservice.Client + Legacy *legacy.Client + Lighthouse *lighthouse.Client + LoadBalancers *loadbalancers.Client + LogAnalytics *loganalytics.Client + Logic *logic.Client + Logz *logz.Client + MachineLearning *machinelearning.Client + Maintenance *maintenance.Client + ManagedApplication *managedapplication.Client + ManagementGroups *managementgroup.Client + Maps *maps.Client + MariaDB *mariadb.Client + Media *media.Client + MixedReality *mixedreality.Client + Monitor *monitor.Client + MobileNetwork *mobilenetwork.Client + MSSQL *mssql.Client + MSSQLManagedInstance *mssqlmanagedinstance.Client + MySQL *mysql.Client + NetApp *netapp.Client + Network *network.Client + NetworkFunction *networkfunction.Client + NewRelic *newrelic.Client + Nginx *nginx2.Client + NotificationHubs *notificationhub.Client + Orbital *orbital.Client + PaloAlto *paloalto.Client + Policy *policy.Client + Portal *portal.Client + Postgres *postgres.Client + PowerBI *powerBI.Client + PrivateDns *privatedns.Client + PrivateDnsResolver *dnsresolver.Client + Purview *purview.Client + RecoveryServices *recoveryServices.Client + Redis *redis_v2023_04_01.Client + RedisEnterprise *redisenterprise.Client + Relay *relay.Client + Resource *resource.Client + Search *search.Client + SecurityCenter *securityCenter.Client + Sentinel *sentinel.Client + ServiceBus *serviceBus.Client + ServiceConnector *serviceConnector.Client + ServiceFabric *serviceFabric.Client + ServiceFabricManaged *serviceFabricManaged.Client + ServiceNetworking *servicenetworking_v2023_05_01_preview.Client + SignalR *signalr.Client + Storage *storage.Client + StorageMover *storageMover.Client + StreamAnalytics *streamAnalytics.Client + Subscription *subscription.Client + Sql *sql.Client + Synapse *synapse.Client + SystemCenterVirtualMachineManager *systemcentervirtualmachinemanager_2023_10_07.Client + TrafficManager *trafficManager.Client + VideoAnalyzer *videoAnalyzer.Client + Vmware *vmware.Client + VoiceServices *voiceServices.Client + Web *web.Client } // NOTE: it should be possible for this method to become Private once the top level Client's removed @@ -601,6 +604,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.StreamAnalytics = streamAnalytics.NewClient(o) client.Subscription = subscription.NewClient(o) client.Synapse = synapse.NewClient(o) + if client.SystemCenterVirtualMachineManager, err = systemCenterVirtualMachineManager.NewClient(o); err != nil { + return fmt.Errorf("building clients for System Center Virtual Machine Manager: %+v", err) + } if client.TrafficManager, err = trafficManager.NewClient(o); err != nil { return fmt.Errorf("building clients for Traffic Manager: %+v", err) } diff --git a/internal/provider/services.go b/internal/provider/services.go index 197e454e7fda..4f6e7e06cf07 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -124,6 +124,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/streamanalytics" "github.com/hashicorp/terraform-provider-azurerm/internal/services/subscription" "github.com/hashicorp/terraform-provider-azurerm/internal/services/synapse" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager" "github.com/hashicorp/terraform-provider-azurerm/internal/services/trafficmanager" "github.com/hashicorp/terraform-provider-azurerm/internal/services/videoanalyzer" "github.com/hashicorp/terraform-provider-azurerm/internal/services/vmware" @@ -202,6 +203,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { search.Registration{}, springcloud.Registration{}, securitycenter.Registration{}, + systemcentervirtualmachinemanager.Registration{}, vmware.Registration{}, voiceservices.Registration{}, web.Registration{}, diff --git a/internal/services/systemcentervirtualmachinemanager/client/client.go b/internal/services/systemcentervirtualmachinemanager/client/client.go new file mode 100644 index 000000000000..69d8f5876462 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/client/client.go @@ -0,0 +1,20 @@ +package client + +import ( + "fmt" + + systemcentervirtualmachinemanager_2023_10_07 "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +func NewClient(o *common.ClientOptions) (*systemcentervirtualmachinemanager_2023_10_07.Client, error) { + client, err := systemcentervirtualmachinemanager_2023_10_07.NewClientWithBaseURI(o.Environment.ResourceManager, func(c *resourcemanager.Client) { + o.Configure(c, o.Authorizers.ResourceManager) + }) + if err != nil { + return nil, fmt.Errorf("building System Center Virtual Machine Manager client: %+v", err) + } + + return client, nil +} diff --git a/internal/services/systemcentervirtualmachinemanager/registration.go b/internal/services/systemcentervirtualmachinemanager/registration.go new file mode 100644 index 000000000000..dcb97a015b82 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/registration.go @@ -0,0 +1,35 @@ +package systemcentervirtualmachinemanager + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} + +func (r Registration) AssociatedGitHubLabel() string { + return "service/systemcentervirtualmachinemanager" +} + +// Name is the name of this Service +func (r Registration) Name() string { + return "System Center Virtual Machine Manager" +} + +// WebsiteCategories returns a list of categories which can be used for the sidebar +func (r Registration) WebsiteCategories() []string { + return []string{ + "System Center Virtual Machine Manager", + } +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + SystemCenterVirtualMachineManagerServerResource{}, + } +} diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go new file mode 100644 index 000000000000..d3d48eef6aa7 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -0,0 +1,306 @@ +package systemcentervirtualmachinemanager + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/pointer" + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" + "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SystemCenterVirtualMachineManagerServerModel struct { + Name string `tfschema:"name"` + ResourceGroupName string `tfschema:"resource_group_name"` + Location string `tfschema:"location"` + CustomLocationId string `tfschema:"custom_location_id"` + Fqdn string `tfschema:"fqdn"` + Credential []Credential `tfschema:"credential"` + Port int `tfschema:"port"` + Tags map[string]string `tfschema:"tags"` +} + +type Credential struct { + Username string `tfschema:"username"` + Password string `tfschema:"password"` +} + +var _ sdk.Resource = SystemCenterVirtualMachineManagerServerResource{} +var _ sdk.ResourceWithUpdate = SystemCenterVirtualMachineManagerServerResource{} + +type SystemCenterVirtualMachineManagerServerResource struct{} + +func (r SystemCenterVirtualMachineManagerServerResource) ModelObject() interface{} { + return &SystemCenterVirtualMachineManagerServerModel{} +} + +func (r SystemCenterVirtualMachineManagerServerResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return vmmservers.ValidateVMmServerID +} + +func (r SystemCenterVirtualMachineManagerServerResource) ResourceType() string { + return "azurerm_system_center_virtual_machine_manager_server" +} + +func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SystemCenterVirtualMachineManagerServerName, + }, + + "resource_group_name": commonschema.ResourceGroupName(), + + "location": commonschema.Location(), + + "custom_location_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Required: true, + }, + + "credential": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "username": { + Type: pluginsdk.TypeString, + Optional: true, + }, + + "password": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + }, + }, + }, + }, + + "port": { + Type: pluginsdk.TypeInt, + Optional: true, + ValidateFunc: validation.IntBetween(1, 65535), + }, + + "tags": commonschema.Tags(), + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Attributes() map[string]*pluginsdk.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r SystemCenterVirtualMachineManagerServerResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + subscriptionId := metadata.Client.Account.SubscriptionId + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + var model SystemCenterVirtualMachineManagerServerModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + id := vmmservers.NewVMmServerID(subscriptionId, model.ResourceGroupName, model.Name) + + existing, err := client.Get(ctx, id) + if err != nil { + if !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for the presence of an existing %s: %+v", id, err) + } + } + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + parameters := &vmmservers.VMMServer{ + Location: location.Normalize(model.Location), + ExtendedLocation: vmmservers.ExtendedLocation{ + Type: utils.String("customLocation"), + Name: utils.String(model.CustomLocationId), + }, + Properties: vmmservers.VMMServerProperties{ + Credentials: expandSystemCenterVirtualMachineManagerServerCredential(model.Credential), + Fqdn: model.Fqdn, + }, + Tags: pointer.To(model.Tags), + } + + if model.Port != 0 { + parameters.Properties.Port = utils.Int64(int64(model.Port)) + } + + if err := client.CreateOrUpdateThenPoll(ctx, id, *parameters); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + id, err := vmmservers.ParseVMmServerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.Get(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(*id) + } + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + state := SystemCenterVirtualMachineManagerServerModel{} + if model := resp.Model; model != nil { + state.Name = id.VmmServerName + state.ResourceGroupName = id.ResourceGroupName + state.Location = location.Normalize(model.Location) + state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) + state.Fqdn = model.Properties.Fqdn + state.Credential = flattenSystemCenterVirtualMachineManagerServerCredential(model.Properties.Credentials) + state.Tags = pointer.From(model.Tags) + + if v := model.Properties.Port; v != nil { + state.Port = int(*v) + } + } + + return metadata.Encode(&state) + }, + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + id, err := vmmservers.ParseVMmServerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var model SystemCenterVirtualMachineManagerServerModel + if err := metadata.Decode(&model); err != nil { + return fmt.Errorf("decoding: %+v", err) + } + + existing, err := client.Get(ctx, *id) + if err != nil { + return fmt.Errorf("retrieving %s: %+v", *id, err) + } + + parameters := existing.Model + if parameters == nil { + return fmt.Errorf("retrieving %s: model was nil", *id) + } + + if metadata.ResourceData.HasChange("custom_location_id") { + parameters.ExtendedLocation = vmmservers.ExtendedLocation{ + Type: utils.String("customLocation"), + Name: utils.String(model.CustomLocationId), + } + } + + if metadata.ResourceData.HasChange("fqdn") { + parameters.Properties.Fqdn = model.Fqdn + } + + if metadata.ResourceData.HasChange("port") { + parameters.Properties.Port = utils.Int64(int64(model.Port)) + } + + if metadata.ResourceData.HasChange("credential") { + parameters.Properties.Credentials = expandSystemCenterVirtualMachineManagerServerCredential(model.Credential) + } + + if metadata.ResourceData.HasChange("tags") { + parameters.Tags = pointer.To(model.Tags) + } + + if err := client.CreateOrUpdateThenPoll(ctx, *id, *parameters); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + + return nil + }, + } +} + +func (r SystemCenterVirtualMachineManagerServerResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.SystemCenterVirtualMachineManager.VMmServers + + id, err := vmmservers.ParseVMmServerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + if err := client.DeleteThenPoll(ctx, *id, vmmservers.DeleteOperationOptions{Force: pointer.To(vmmservers.ForceTrue)}); err != nil { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + + return nil + }, + } +} + +func expandSystemCenterVirtualMachineManagerServerCredential(input []Credential) *vmmservers.VMMCredential { + if len(input) == 0 { + return nil + } + + credential := &input[0] + + result := &vmmservers.VMMCredential{ + Username: pointer.To(credential.Username), + Password: pointer.To(credential.Password), + } + + return result +} + +func flattenSystemCenterVirtualMachineManagerServerCredential(input *vmmservers.VMMCredential) []Credential { + result := make([]Credential, 0) + if input == nil { + return result + } + + credential := Credential{ + Username: pointer.From(input.Username), + Password: pointer.From(input.Password), + } + + return append(result, credential) +} diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go new file mode 100644 index 000000000000..49a0cd2472a1 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -0,0 +1,190 @@ +package systemcentervirtualmachinemanager_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SystemCenterVirtualMachineManagerServerResource struct{} + +func TestAccSystemCenterVirtualMachineManagerServer_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSystemCenterVirtualMachineManagerServer_requiresImport(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.basic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.RequiresImportErrorStep(r.requiresImport), + }) +} + +func TestAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") + r := SystemCenterVirtualMachineManagerServerResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + { + Config: r.update(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r SystemCenterVirtualMachineManagerServerResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := vmmservers.ParseVMmServerID(state.ID) + if err != nil { + return nil, err + } + + resp, err := clients.SystemCenterVirtualMachineManager.VMmServers.Get(ctx, *id) + if err != nil { + return nil, fmt.Errorf("reading %s: %+v", *id, err) + } + + return utils.Bool(resp.Model != nil), nil +} + +func (r SystemCenterVirtualMachineManagerServerResource) basic(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = azurerm_custom_location.test.id + fqdn = "testdomain.com" +} +`, r.template(data), data.RandomInteger) +} + +func (r SystemCenterVirtualMachineManagerServerResource) requiresImport(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_system_center_virtual_machine_manager_server" "import" { + name = azurerm_system_center_virtual_machine_manager_server.test.name + resource_group_name = azurerm_system_center_virtual_machine_manager_server.test.resource_group_name + location = azurerm_system_center_virtual_machine_manager_server.test.location + custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id + fqdn = azurerm_system_center_virtual_machine_manager_server.test.fqdn +} +`, r.basic(data)) +} + +func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = azurerm_custom_location.test.id + fqdn = "testdomain.com" + port = 10000 + + credential { + username = "adminTerraform" + password = "QAZwsx123" + } + + tags = { + Env = "Test" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r SystemCenterVirtualMachineManagerServerResource) update(data acceptance.TestData) string { + return fmt.Sprintf(` +%s + +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = azurerm_custom_location.test.id + fqdn = "testdomain2.com" + port = 10001 + + credential { + username = "adminTerraform2" + password = "QAZwsx124" + } + + tags = { + Env = "Test2" + } +} +`, r.template(data), data.RandomInteger) +} + +func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestrg-scvmmms-%d" + location = "%s" +} + +resource "azurerm_custom_location" "test" { + name = "acctest-cl-%d" +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go new file mode 100644 index 000000000000..bd11403b08ad --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name.go @@ -0,0 +1,20 @@ +package validate + +import ( + "fmt" + "regexp" +) + +func SystemCenterVirtualMachineManagerServerName(i interface{}, k string) (warnings []string, errors []error) { + v, ok := i.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected type of %q to be string", k)) + return + } + + if !regexp.MustCompile("^[a-zA-Z0-9]([-.a-zA-Z0-9]{0,52}[a-zA-Z0-9])?$").MatchString(v) { + errors = append(errors, fmt.Errorf("%q must start and end with an alphanumeric character, may contain alphanumeric characters, dashes or periods and must be between 1 and 54 characters long", k)) + } + + return warnings, errors +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go new file mode 100644 index 000000000000..0faa166e8b2b --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/system_center_virtual_machine_manager_server_name_test.go @@ -0,0 +1,58 @@ +package validate + +import ( + "strings" + "testing" +) + +func TestSystemCenterVirtualMachineManagerServerName(t *testing.T) { + testCases := []struct { + Input string + Expected bool + }{ + { + Input: "", + Expected: false, + }, + { + Input: "a", + Expected: true, + }, + { + Input: "a8a", + Expected: true, + }, + { + Input: "a-8.a", + Expected: true, + }, + { + Input: "a-", + Expected: false, + }, + { + Input: "a.", + Expected: false, + }, + { + Input: strings.Repeat("s", 53), + Expected: true, + }, + { + Input: strings.Repeat("s", 54), + Expected: true, + }, + { + Input: strings.Repeat("s", 55), + Expected: false, + }, + } + + for _, v := range testCases { + _, errors := SystemCenterVirtualMachineManagerServerName(v.Input, "time_of_day_in_utc") + result := len(errors) == 0 + if result != v.Expected { + t.Fatalf("Expected the result to be %t but got %t (and %d errors)", v.Expected, result, len(errors)) + } + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md new file mode 100644 index 000000000000..3205b183e57e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets` Documentation + +The `availabilitysets` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets" +``` + + +### Client Initialization + +```go +client := availabilitysets.NewAvailabilitySetsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `AvailabilitySetsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +payload := availabilitysets.AvailabilitySet{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `AvailabilitySetsClient.Delete` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +if err := client.DeleteThenPoll(ctx, id, availabilitysets.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `AvailabilitySetsClient.Get` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +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.ListByResourceGroup` + +```go +ctx := context.TODO() +id := availabilitysets.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: `AvailabilitySetsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := availabilitysets.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: `AvailabilitySetsClient.Update` + +```go +ctx := context.TODO() +id := availabilitysets.NewAvailabilitySetID("12345678-1234-9876-4563-123456789012", "example-resource-group", "availabilitySetValue") + +payload := availabilitysets.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/client.go new file mode 100644 index 000000000000..54ef249b4a80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/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.NewResourceManagerClient(sdkApi, "availabilitysets", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating AvailabilitySetsClient: %+v", err) + } + + return &AvailabilitySetsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go new file mode 100644 index 000000000000..4de67ae6b667 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/constants.go @@ -0,0 +1,110 @@ +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go new file mode 100644 index 000000000000..ae57f4330c97 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go @@ -0,0 +1,127 @@ +package availabilitysets + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = AvailabilitySetId{} + +// AvailabilitySetId is a struct representing the Resource ID for a Availability Set +type AvailabilitySetId struct { + SubscriptionId string + ResourceGroupName string + AvailabilitySetName string +} + +// NewAvailabilitySetID returns a new AvailabilitySetId struct +func NewAvailabilitySetID(subscriptionId string, resourceGroupName string, availabilitySetName string) AvailabilitySetId { + return AvailabilitySetId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + AvailabilitySetName: availabilitySetName, + } +} + +// ParseAvailabilitySetID parses 'input' into a AvailabilitySetId +func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { + parser := resourceids.NewParserFromResourceIdType(AvailabilitySetId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AvailabilitySetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + } + + return &id, nil +} + +// ParseAvailabilitySetIDInsensitively parses 'input' case-insensitively into a AvailabilitySetId +// note: this method should only be used for API response data and not user input +func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, error) { + parser := resourceids.NewParserFromResourceIdType(AvailabilitySetId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := AvailabilitySetId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + } + + return &id, nil +} + +// ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID +func ValidateAvailabilitySetID(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 := ParseAvailabilitySetID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Availability Set ID +func (id AvailabilitySetId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/availabilitySets/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.AvailabilitySetName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Availability Set ID +func (id AvailabilitySetId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticAvailabilitySets", "availabilitySets", "availabilitySets"), + resourceids.UserSpecifiedSegment("availabilitySetName", "availabilitySetValue"), + } +} + +// String returns a human-readable description of this Availability Set ID +func (id AvailabilitySetId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Availability Set Name: %q", id.AvailabilitySetName), + } + return fmt.Sprintf("Availability Set (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go new file mode 100644 index 000000000000..63ada7c8e684 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_createorupdate.go @@ -0,0 +1,74 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c AvailabilitySetsClient) CreateOrUpdate(ctx context.Context, id AvailabilitySetId, input AvailabilitySet) (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 AvailabilitySetsClient) CreateOrUpdateThenPoll(ctx context.Context, id AvailabilitySetId, input AvailabilitySet) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go new file mode 100644 index 000000000000..feb65fd44090 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_delete.go @@ -0,0 +1,98 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/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 { + Force *Force +} + +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.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c AvailabilitySetsClient) Delete(ctx context.Context, id AvailabilitySetId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c AvailabilitySetsClient) DeleteThenPoll(ctx context.Context, id AvailabilitySetId, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go new file mode 100644 index 000000000000..5aee17cea0c6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_get.go @@ -0,0 +1,51 @@ +package availabilitysets + +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 *AvailabilitySet +} + +// Get ... +func (c AvailabilitySetsClient) Get(ctx context.Context, id 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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go new file mode 100644 index 000000000000..7e58d9fff3ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +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 ListByResourceGroupOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]AvailabilitySet +} + +type ListByResourceGroupCompleteResult struct { + Items []AvailabilitySet +} + +// ListByResourceGroup ... +func (c AvailabilitySetsClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/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 +} + +// ListByResourceGroupComplete retrieves all the results into a single object +func (c AvailabilitySetsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate AvailabilitySetOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go new file mode 100644 index 000000000000..d834bb04e8a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_listbysubscription.go @@ -0,0 +1,90 @@ +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 { + Items []AvailabilitySet +} + +// ListBySubscription ... +func (c AvailabilitySetsClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/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) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, AvailabilitySetOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c AvailabilitySetsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate AvailabilitySetOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]AvailabilitySet, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go new file mode 100644 index 000000000000..610729e2284c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/method_update.go @@ -0,0 +1,74 @@ +package availabilitysets + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c AvailabilitySetsClient) Update(ctx context.Context, id AvailabilitySetId, input ResourcePatch) (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 AvailabilitySetsClient) UpdateThenPoll(ctx context.Context, id AvailabilitySetId, input ResourcePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go new file mode 100644 index 000000000000..c1bb50264991 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilityset.go @@ -0,0 +1,19 @@ +package availabilitysets + +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 AvailabilitySet struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties AvailabilitySetProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.go new file mode 100644 index 000000000000..519440060de5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_availabilitysetproperties.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 AvailabilitySetProperties struct { + AvailabilitySetName *string `json:"availabilitySetName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.go new file mode 100644 index 000000000000..da53bf74ea1c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_extendedlocation.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 ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.go new file mode 100644 index 000000000000..8ddbdd73387b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/model_resourcepatch.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 ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/predicates.go new file mode 100644 index 000000000000..bb3e2b2b319f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go new file mode 100644 index 000000000000..b5ddd1201cca --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/version.go @@ -0,0 +1,12 @@ +package availabilitysets + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/availabilitysets/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go new file mode 100644 index 000000000000..3523a8784b20 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/client.go @@ -0,0 +1,100 @@ +package v2023_10_07 + +// 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/systemcentervirtualmachinemanager/2023-10-07/availabilitysets" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata" + "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + sdkEnv "github.com/hashicorp/go-azure-sdk/sdk/environments" +) + +type Client struct { + AvailabilitySets *availabilitysets.AvailabilitySetsClient + Clouds *clouds.CloudsClient + InventoryItems *inventoryitems.InventoryItemsClient + VMInstanceGuestAgents *vminstanceguestagents.VMInstanceGuestAgentsClient + VMInstanceHybridIdentityMetadata *vminstancehybrididentitymetadata.VMInstanceHybridIdentityMetadataClient + VMmServers *vmmservers.VMmServersClient + VirtualMachineInstances *virtualmachineinstances.VirtualMachineInstancesClient + VirtualMachineTemplates *virtualmachinetemplates.VirtualMachineTemplatesClient + VirtualNetworks *virtualnetworks.VirtualNetworksClient +} + +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) + + cloudsClient, err := clouds.NewCloudsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building Clouds client: %+v", err) + } + configureFunc(cloudsClient.Client) + + inventoryItemsClient, err := inventoryitems.NewInventoryItemsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building InventoryItems client: %+v", err) + } + configureFunc(inventoryItemsClient.Client) + + vMInstanceGuestAgentsClient, err := vminstanceguestagents.NewVMInstanceGuestAgentsClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VMInstanceGuestAgents client: %+v", err) + } + configureFunc(vMInstanceGuestAgentsClient.Client) + + vMInstanceHybridIdentityMetadataClient, err := vminstancehybrididentitymetadata.NewVMInstanceHybridIdentityMetadataClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VMInstanceHybridIdentityMetadata client: %+v", err) + } + configureFunc(vMInstanceHybridIdentityMetadataClient.Client) + + vMmServersClient, err := vmmservers.NewVMmServersClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VMmServers client: %+v", err) + } + configureFunc(vMmServersClient.Client) + + virtualMachineInstancesClient, err := virtualmachineinstances.NewVirtualMachineInstancesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineInstances client: %+v", err) + } + configureFunc(virtualMachineInstancesClient.Client) + + virtualMachineTemplatesClient, err := virtualmachinetemplates.NewVirtualMachineTemplatesClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualMachineTemplates client: %+v", err) + } + configureFunc(virtualMachineTemplatesClient.Client) + + virtualNetworksClient, err := virtualnetworks.NewVirtualNetworksClientWithBaseURI(sdkApi) + if err != nil { + return nil, fmt.Errorf("building VirtualNetworks client: %+v", err) + } + configureFunc(virtualNetworksClient.Client) + + return &Client{ + AvailabilitySets: availabilitySetsClient, + Clouds: cloudsClient, + InventoryItems: inventoryItemsClient, + VMInstanceGuestAgents: vMInstanceGuestAgentsClient, + VMInstanceHybridIdentityMetadata: vMInstanceHybridIdentityMetadataClient, + VMmServers: vMmServersClient, + VirtualMachineInstances: virtualMachineInstancesClient, + VirtualMachineTemplates: virtualMachineTemplatesClient, + VirtualNetworks: virtualNetworksClient, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md new file mode 100644 index 000000000000..4338e93e4e63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds` Documentation + +The `clouds` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/clouds" +``` + + +### Client Initialization + +```go +client := clouds.NewCloudsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CloudsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +payload := clouds.Cloud{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudsClient.Delete` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +if err := client.DeleteThenPoll(ctx, id, clouds.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `CloudsClient.Get` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +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: `CloudsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := clouds.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: `CloudsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := clouds.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: `CloudsClient.Update` + +```go +ctx := context.TODO() +id := clouds.NewCloudID("12345678-1234-9876-4563-123456789012", "example-resource-group", "cloudValue") + +payload := clouds.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go new file mode 100644 index 000000000000..9720d3715983 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/client.go @@ -0,0 +1,26 @@ +package clouds + +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 CloudsClient struct { + Client *resourcemanager.Client +} + +func NewCloudsClientWithBaseURI(sdkApi sdkEnv.Api) (*CloudsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "clouds", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CloudsClient: %+v", err) + } + + return &CloudsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go new file mode 100644 index 000000000000..416af769cd75 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/constants.go @@ -0,0 +1,110 @@ +package clouds + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go new file mode 100644 index 000000000000..57d2b09f4552 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go @@ -0,0 +1,127 @@ +package clouds + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = CloudId{} + +// CloudId is a struct representing the Resource ID for a Cloud +type CloudId struct { + SubscriptionId string + ResourceGroupName string + CloudName string +} + +// NewCloudID returns a new CloudId struct +func NewCloudID(subscriptionId string, resourceGroupName string, cloudName string) CloudId { + return CloudId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CloudName: cloudName, + } +} + +// ParseCloudID parses 'input' into a CloudId +func ParseCloudID(input string) (*CloudId, error) { + parser := resourceids.NewParserFromResourceIdType(CloudId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.CloudName, ok = parsed.Parsed["cloudName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudName", *parsed) + } + + return &id, nil +} + +// ParseCloudIDInsensitively parses 'input' case-insensitively into a CloudId +// note: this method should only be used for API response data and not user input +func ParseCloudIDInsensitively(input string) (*CloudId, error) { + parser := resourceids.NewParserFromResourceIdType(CloudId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := CloudId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.CloudName, ok = parsed.Parsed["cloudName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudName", *parsed) + } + + return &id, nil +} + +// ValidateCloudID checks that 'input' can be parsed as a Cloud ID +func ValidateCloudID(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 := ParseCloudID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Cloud ID +func (id CloudId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/clouds/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CloudName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Cloud ID +func (id CloudId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticClouds", "clouds", "clouds"), + resourceids.UserSpecifiedSegment("cloudName", "cloudValue"), + } +} + +// String returns a human-readable description of this Cloud ID +func (id CloudId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Cloud Name: %q", id.CloudName), + } + return fmt.Sprintf("Cloud (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go new file mode 100644 index 000000000000..92e82bc5145c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_createorupdate.go @@ -0,0 +1,74 @@ +package clouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c CloudsClient) CreateOrUpdate(ctx context.Context, id CloudId, input Cloud) (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 CloudsClient) CreateOrUpdateThenPoll(ctx context.Context, id CloudId, input Cloud) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go new file mode 100644 index 000000000000..c0f1ded3cfce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_delete.go @@ -0,0 +1,98 @@ +package clouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/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 { + Force *Force +} + +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.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c CloudsClient) Delete(ctx context.Context, id CloudId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c CloudsClient) DeleteThenPoll(ctx context.Context, id CloudId, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go new file mode 100644 index 000000000000..5524d6f14e16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_get.go @@ -0,0 +1,51 @@ +package clouds + +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 *Cloud +} + +// Get ... +func (c CloudsClient) Get(ctx context.Context, id CloudId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go new file mode 100644 index 000000000000..280242331e35 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package clouds + +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 *[]Cloud +} + +type ListByResourceGroupCompleteResult struct { + Items []Cloud +} + +// ListByResourceGroup ... +func (c CloudsClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/clouds", 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 *[]Cloud `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 CloudsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CloudOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CloudOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]Cloud, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go new file mode 100644 index 000000000000..dd82391ffc54 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_listbysubscription.go @@ -0,0 +1,90 @@ +package clouds + +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 *[]Cloud +} + +type ListBySubscriptionCompleteResult struct { + Items []Cloud +} + +// ListBySubscription ... +func (c CloudsClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/clouds", 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 *[]Cloud `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 CloudsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CloudOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CloudsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CloudOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]Cloud, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go new file mode 100644 index 000000000000..3909ba8abe6e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/method_update.go @@ -0,0 +1,74 @@ +package clouds + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c CloudsClient) Update(ctx context.Context, id CloudId, input ResourcePatch) (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 CloudsClient) UpdateThenPoll(ctx context.Context, id CloudId, input ResourcePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go new file mode 100644 index 000000000000..54782e1c6b58 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloud.go @@ -0,0 +1,19 @@ +package clouds + +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 Cloud struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties CloudProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go new file mode 100644 index 000000000000..7fbcddbb947c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudcapacity.go @@ -0,0 +1,10 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudCapacity struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` + VMCount *int64 `json:"vmCount,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go new file mode 100644 index 000000000000..dfac177c333f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_cloudproperties.go @@ -0,0 +1,14 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudProperties struct { + CloudCapacity *CloudCapacity `json:"cloudCapacity,omitempty"` + CloudName *string `json:"cloudName,omitempty"` + InventoryItemId *string `json:"inventoryItemId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + StorageQoSPolicies *[]StorageQoSPolicy `json:"storageQoSPolicies,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go new file mode 100644 index 000000000000..256e3cfbe79a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_extendedlocation.go @@ -0,0 +1,9 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go new file mode 100644 index 000000000000..2b70badeeb85 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_resourcepatch.go @@ -0,0 +1,8 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go new file mode 100644 index 000000000000..8425348c5c63 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/model_storageqospolicy.go @@ -0,0 +1,13 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageQoSPolicy struct { + BandwidthLimit *int64 `json:"bandwidthLimit,omitempty"` + Id *string `json:"id,omitempty"` + IopsMaximum *int64 `json:"iopsMaximum,omitempty"` + IopsMinimum *int64 `json:"iopsMinimum,omitempty"` + Name *string `json:"name,omitempty"` + PolicyId *string `json:"policyId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go new file mode 100644 index 000000000000..6e1395597d1e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/predicates.go @@ -0,0 +1,32 @@ +package clouds + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CloudOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CloudOperationPredicate) Matches(input Cloud) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go new file mode 100644 index 000000000000..1935d3db1000 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/version.go @@ -0,0 +1,12 @@ +package clouds + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/clouds/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md new file mode 100644 index 000000000000..c76bf2a8e039 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/README.md @@ -0,0 +1,90 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems` Documentation + +The `inventoryitems` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/inventoryitems" +``` + + +### Client Initialization + +```go +client := inventoryitems.NewInventoryItemsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `InventoryItemsClient.Create` + +```go +ctx := context.TODO() +id := inventoryitems.NewInventoryItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue", "inventoryItemValue") + +payload := inventoryitems.InventoryItem{ + // ... +} + + +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: `InventoryItemsClient.Delete` + +```go +ctx := context.TODO() +id := inventoryitems.NewInventoryItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue", "inventoryItemValue") + +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: `InventoryItemsClient.Get` + +```go +ctx := context.TODO() +id := inventoryitems.NewInventoryItemID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue", "inventoryItemValue") + +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: `InventoryItemsClient.ListByVMMServer` + +```go +ctx := context.TODO() +id := inventoryitems.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +// alternatively `client.ListByVMMServer(ctx, id)` can be used to do batched pagination +items, err := client.ListByVMMServerComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go new file mode 100644 index 000000000000..fbe00f649ccb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/client.go @@ -0,0 +1,26 @@ +package inventoryitems + +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 InventoryItemsClient struct { + Client *resourcemanager.Client +} + +func NewInventoryItemsClientWithBaseURI(sdkApi sdkEnv.Api) (*InventoryItemsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "inventoryitems", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating InventoryItemsClient: %+v", err) + } + + return &InventoryItemsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go new file mode 100644 index 000000000000..d7e2dc448d89 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/constants.go @@ -0,0 +1,160 @@ +package inventoryitems + +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 InventoryType string + +const ( + InventoryTypeCloud InventoryType = "Cloud" + InventoryTypeVirtualMachine InventoryType = "VirtualMachine" + InventoryTypeVirtualMachineTemplate InventoryType = "VirtualMachineTemplate" + InventoryTypeVirtualNetwork InventoryType = "VirtualNetwork" +) + +func PossibleValuesForInventoryType() []string { + return []string{ + string(InventoryTypeCloud), + string(InventoryTypeVirtualMachine), + string(InventoryTypeVirtualMachineTemplate), + string(InventoryTypeVirtualNetwork), + } +} + +func (s *InventoryType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseInventoryType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseInventoryType(input string) (*InventoryType, error) { + vals := map[string]InventoryType{ + "cloud": InventoryTypeCloud, + "virtualmachine": InventoryTypeVirtualMachine, + "virtualmachinetemplate": InventoryTypeVirtualMachineTemplate, + "virtualnetwork": InventoryTypeVirtualNetwork, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := InventoryType(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeOther OsType = "Other" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeOther), + string(OsTypeWindows), + } +} + +func (s *OsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOsType(input string) (*OsType, error) { + vals := map[string]OsType{ + "linux": OsTypeLinux, + "other": OsTypeOther, + "windows": OsTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OsType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go new file mode 100644 index 000000000000..1814b6aabd07 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go @@ -0,0 +1,140 @@ +package inventoryitems + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = InventoryItemId{} + +// InventoryItemId is a struct representing the Resource ID for a Inventory Item +type InventoryItemId struct { + SubscriptionId string + ResourceGroupName string + VmmServerName string + InventoryItemName string +} + +// NewInventoryItemID returns a new InventoryItemId struct +func NewInventoryItemID(subscriptionId string, resourceGroupName string, vmmServerName string, inventoryItemName string) InventoryItemId { + return InventoryItemId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VmmServerName: vmmServerName, + InventoryItemName: inventoryItemName, + } +} + +// ParseInventoryItemID parses 'input' into a InventoryItemId +func ParseInventoryItemID(input string) (*InventoryItemId, error) { + parser := resourceids.NewParserFromResourceIdType(InventoryItemId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := InventoryItemId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + } + + if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + } + + return &id, nil +} + +// ParseInventoryItemIDInsensitively parses 'input' case-insensitively into a InventoryItemId +// note: this method should only be used for API response data and not user input +func ParseInventoryItemIDInsensitively(input string) (*InventoryItemId, error) { + parser := resourceids.NewParserFromResourceIdType(InventoryItemId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := InventoryItemId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + } + + if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + } + + return &id, nil +} + +// ValidateInventoryItemID checks that 'input' can be parsed as a Inventory Item ID +func ValidateInventoryItemID(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 := ParseInventoryItemID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Inventory Item ID +func (id InventoryItemId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/vmmServers/%s/inventoryItems/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VmmServerName, id.InventoryItemName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Inventory Item ID +func (id InventoryItemId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVmmServers", "vmmServers", "vmmServers"), + resourceids.UserSpecifiedSegment("vmmServerName", "vmmServerValue"), + resourceids.StaticSegment("staticInventoryItems", "inventoryItems", "inventoryItems"), + resourceids.UserSpecifiedSegment("inventoryItemName", "inventoryItemValue"), + } +} + +// String returns a human-readable description of this Inventory Item ID +func (id InventoryItemId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vmm Server Name: %q", id.VmmServerName), + fmt.Sprintf("Inventory Item Name: %q", id.InventoryItemName), + } + return fmt.Sprintf("Inventory Item (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go new file mode 100644 index 000000000000..22a411b74225 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go @@ -0,0 +1,127 @@ +package inventoryitems + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = VMmServerId{} + +// VMmServerId is a struct representing the Resource ID for a V Mm Server +type VMmServerId struct { + SubscriptionId string + ResourceGroupName string + VmmServerName string +} + +// NewVMmServerID returns a new VMmServerId struct +func NewVMmServerID(subscriptionId string, resourceGroupName string, vmmServerName string) VMmServerId { + return VMmServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VmmServerName: vmmServerName, + } +} + +// ParseVMmServerID parses 'input' into a VMmServerId +func ParseVMmServerID(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(VMmServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMmServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + } + + return &id, nil +} + +// ParseVMmServerIDInsensitively parses 'input' case-insensitively into a VMmServerId +// note: this method should only be used for API response data and not user input +func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(VMmServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMmServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + } + + return &id, nil +} + +// ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID +func ValidateVMmServerID(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 := ParseVMmServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted V Mm Server ID +func (id VMmServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/vmmServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VmmServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this V Mm Server ID +func (id VMmServerId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVmmServers", "vmmServers", "vmmServers"), + resourceids.UserSpecifiedSegment("vmmServerName", "vmmServerValue"), + } +} + +// String returns a human-readable description of this V Mm Server ID +func (id VMmServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vmm Server Name: %q", id.VmmServerName), + } + return fmt.Sprintf("V Mm Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go new file mode 100644 index 000000000000..ab6fe5391575 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_create.go @@ -0,0 +1,56 @@ +package inventoryitems + +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 *InventoryItem +} + +// Create ... +func (c InventoryItemsClient) Create(ctx context.Context, id InventoryItemId, input InventoryItem) (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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go new file mode 100644 index 000000000000..12d362566681 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_delete.go @@ -0,0 +1,47 @@ +package inventoryitems + +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 InventoryItemsClient) Delete(ctx context.Context, id InventoryItemId) (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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go new file mode 100644 index 000000000000..ba12f1d9f3b8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_get.go @@ -0,0 +1,51 @@ +package inventoryitems + +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 *InventoryItem +} + +// Get ... +func (c InventoryItemsClient) Get(ctx context.Context, id InventoryItemId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go new file mode 100644 index 000000000000..2dd129180ef1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/method_listbyvmmserver.go @@ -0,0 +1,89 @@ +package inventoryitems + +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 ListByVMMServerOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]InventoryItem +} + +type ListByVMMServerCompleteResult struct { + Items []InventoryItem +} + +// ListByVMMServer ... +func (c InventoryItemsClient) ListByVMMServer(ctx context.Context, id VMmServerId) (result ListByVMMServerOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/inventoryItems", 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 *[]InventoryItem `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListByVMMServerComplete retrieves all the results into a single object +func (c InventoryItemsClient) ListByVMMServerComplete(ctx context.Context, id VMmServerId) (ListByVMMServerCompleteResult, error) { + return c.ListByVMMServerCompleteMatchingPredicate(ctx, id, InventoryItemOperationPredicate{}) +} + +// ListByVMMServerCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c InventoryItemsClient) ListByVMMServerCompleteMatchingPredicate(ctx context.Context, id VMmServerId, predicate InventoryItemOperationPredicate) (result ListByVMMServerCompleteResult, err error) { + items := make([]InventoryItem, 0) + + resp, err := c.ListByVMMServer(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByVMMServerCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go new file mode 100644 index 000000000000..b8d67d2a4b2d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_cloudinventoryitem.go @@ -0,0 +1,44 @@ +package inventoryitems + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ InventoryItemProperties = CloudInventoryItem{} + +type CloudInventoryItem struct { + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = CloudInventoryItem{} + +func (s CloudInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper CloudInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling CloudInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling CloudInventoryItem: %+v", err) + } + decoded["inventoryType"] = "Cloud" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling CloudInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go new file mode 100644 index 000000000000..92f80c1062df --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitem.go @@ -0,0 +1,50 @@ +package inventoryitems + +import ( + "encoding/json" + "fmt" + + "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 InventoryItem struct { + Id *string `json:"id,omitempty"` + Kind *string `json:"kind,omitempty"` + Name *string `json:"name,omitempty"` + Properties InventoryItemProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} + +var _ json.Unmarshaler = &InventoryItem{} + +func (s *InventoryItem) UnmarshalJSON(bytes []byte) error { + type alias InventoryItem + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into InventoryItem: %+v", err) + } + + s.Id = decoded.Id + s.Kind = decoded.Kind + s.Name = decoded.Name + s.SystemData = decoded.SystemData + s.Type = decoded.Type + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling InventoryItem into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["properties"]; ok { + impl, err := unmarshalInventoryItemPropertiesImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'Properties' for 'InventoryItem': %+v", err) + } + s.Properties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go new file mode 100644 index 000000000000..e5636a2456da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemdetails.go @@ -0,0 +1,9 @@ +package inventoryitems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InventoryItemDetails struct { + InventoryItemId *string `json:"inventoryItemId,omitempty"` + InventoryItemName *string `json:"inventoryItemName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go new file mode 100644 index 000000000000..897fb127207a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_inventoryitemproperties.go @@ -0,0 +1,77 @@ +package inventoryitems + +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 InventoryItemProperties interface { +} + +// RawInventoryItemPropertiesImpl is returned when the Discriminated Value +// doesn't match any of the defined types +// NOTE: this should only be used when a type isn't defined for this type of Object (as a workaround) +// and is used only for Deserialization (e.g. this cannot be used as a Request Payload). +type RawInventoryItemPropertiesImpl struct { + Type string + Values map[string]interface{} +} + +func unmarshalInventoryItemPropertiesImplementation(input []byte) (InventoryItemProperties, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling InventoryItemProperties into map[string]interface: %+v", err) + } + + value, ok := temp["inventoryType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "Cloud") { + var out CloudInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into CloudInventoryItem: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "VirtualMachine") { + var out VirtualMachineInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into VirtualMachineInventoryItem: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "VirtualMachineTemplate") { + var out VirtualMachineTemplateInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into VirtualMachineTemplateInventoryItem: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "VirtualNetwork") { + var out VirtualNetworkInventoryItem + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into VirtualNetworkInventoryItem: %+v", err) + } + return out, nil + } + + out := RawInventoryItemPropertiesImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go new file mode 100644 index 000000000000..8feb3388a141 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachineinventoryitem.go @@ -0,0 +1,52 @@ +package inventoryitems + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ InventoryItemProperties = VirtualMachineInventoryItem{} + +type VirtualMachineInventoryItem struct { + BiosGuid *string `json:"biosGuid,omitempty"` + Cloud *InventoryItemDetails `json:"cloud,omitempty"` + IPAddresses *[]string `json:"ipAddresses,omitempty"` + ManagedMachineResourceId *string `json:"managedMachineResourceId,omitempty"` + OsName *string `json:"osName,omitempty"` + OsType *OsType `json:"osType,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` + PowerState *string `json:"powerState,omitempty"` + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = VirtualMachineInventoryItem{} + +func (s VirtualMachineInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper VirtualMachineInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling VirtualMachineInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling VirtualMachineInventoryItem: %+v", err) + } + decoded["inventoryType"] = "VirtualMachine" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling VirtualMachineInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go new file mode 100644 index 000000000000..d039273b7497 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualmachinetemplateinventoryitem.go @@ -0,0 +1,48 @@ +package inventoryitems + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ InventoryItemProperties = VirtualMachineTemplateInventoryItem{} + +type VirtualMachineTemplateInventoryItem struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` + OsName *string `json:"osName,omitempty"` + OsType *OsType `json:"osType,omitempty"` + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = VirtualMachineTemplateInventoryItem{} + +func (s VirtualMachineTemplateInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper VirtualMachineTemplateInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling VirtualMachineTemplateInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling VirtualMachineTemplateInventoryItem: %+v", err) + } + decoded["inventoryType"] = "VirtualMachineTemplate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling VirtualMachineTemplateInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go new file mode 100644 index 000000000000..23e698f13a8a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/model_virtualnetworkinventoryitem.go @@ -0,0 +1,44 @@ +package inventoryitems + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ InventoryItemProperties = VirtualNetworkInventoryItem{} + +type VirtualNetworkInventoryItem struct { + + // Fields inherited from InventoryItemProperties + InventoryItemName *string `json:"inventoryItemName,omitempty"` + ManagedResourceId *string `json:"managedResourceId,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} + +var _ json.Marshaler = VirtualNetworkInventoryItem{} + +func (s VirtualNetworkInventoryItem) MarshalJSON() ([]byte, error) { + type wrapper VirtualNetworkInventoryItem + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling VirtualNetworkInventoryItem: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling VirtualNetworkInventoryItem: %+v", err) + } + decoded["inventoryType"] = "VirtualNetwork" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling VirtualNetworkInventoryItem: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go new file mode 100644 index 000000000000..228f404a3763 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/predicates.go @@ -0,0 +1,32 @@ +package inventoryitems + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InventoryItemOperationPredicate struct { + Id *string + Kind *string + Name *string + Type *string +} + +func (p InventoryItemOperationPredicate) Matches(input InventoryItem) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Kind != nil && (input.Kind == nil || *p.Kind != *input.Kind) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go new file mode 100644 index 000000000000..9aa6fde2110d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/version.go @@ -0,0 +1,12 @@ +package inventoryitems + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/inventoryitems/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md new file mode 100644 index 000000000000..be60d7605937 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/README.md @@ -0,0 +1,191 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances` Documentation + +The `virtualmachineinstances` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances" +``` + + +### Client Initialization + +```go +client := virtualmachineinstances.NewVirtualMachineInstancesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineInstancesClient.CreateCheckpoint` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineCreateCheckpoint{ + // ... +} + + +if err := client.CreateCheckpointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineInstance{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.DeleteThenPoll(ctx, id, virtualmachineinstances.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.DeleteCheckpoint` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineDeleteCheckpoint{ + // ... +} + + +if err := client.DeleteCheckpointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +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: `VirtualMachineInstancesClient.List` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-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: `VirtualMachineInstancesClient.Restart` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.RestartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.RestoreCheckpoint` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineRestoreCheckpoint{ + // ... +} + + +if err := client.RestoreCheckpointThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Start` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +if err := client.StartThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Stop` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.StopVirtualMachineOptions{ + // ... +} + + +if err := client.StopThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineInstancesClient.Update` + +```go +ctx := context.TODO() +id := virtualmachineinstances.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := virtualmachineinstances.VirtualMachineInstanceUpdate{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go new file mode 100644 index 000000000000..e40ddc4adf55 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/client.go @@ -0,0 +1,26 @@ +package virtualmachineinstances + +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 VirtualMachineInstancesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineInstancesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineInstancesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualmachineinstances", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineInstancesClient: %+v", err) + } + + return &VirtualMachineInstancesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go new file mode 100644 index 000000000000..14c1b12df63d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/constants.go @@ -0,0 +1,441 @@ +package virtualmachineinstances + +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 AllocationMethod string + +const ( + AllocationMethodDynamic AllocationMethod = "Dynamic" + AllocationMethodStatic AllocationMethod = "Static" +) + +func PossibleValuesForAllocationMethod() []string { + return []string{ + string(AllocationMethodDynamic), + string(AllocationMethodStatic), + } +} + +func (s *AllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationMethod(input string) (*AllocationMethod, error) { + vals := map[string]AllocationMethod{ + "dynamic": AllocationMethodDynamic, + "static": AllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationMethod(input) + return &out, nil +} + +type CreateDiffDisk string + +const ( + CreateDiffDiskFalse CreateDiffDisk = "false" + CreateDiffDiskTrue CreateDiffDisk = "true" +) + +func PossibleValuesForCreateDiffDisk() []string { + return []string{ + string(CreateDiffDiskFalse), + string(CreateDiffDiskTrue), + } +} + +func (s *CreateDiffDisk) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCreateDiffDisk(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCreateDiffDisk(input string) (*CreateDiffDisk, error) { + vals := map[string]CreateDiffDisk{ + "false": CreateDiffDiskFalse, + "true": CreateDiffDiskTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateDiffDisk(input) + return &out, nil +} + +type DeleteFromHost string + +const ( + DeleteFromHostFalse DeleteFromHost = "false" + DeleteFromHostTrue DeleteFromHost = "true" +) + +func PossibleValuesForDeleteFromHost() []string { + return []string{ + string(DeleteFromHostFalse), + string(DeleteFromHostTrue), + } +} + +func (s *DeleteFromHost) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDeleteFromHost(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDeleteFromHost(input string) (*DeleteFromHost, error) { + vals := map[string]DeleteFromHost{ + "false": DeleteFromHostFalse, + "true": DeleteFromHostTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DeleteFromHost(input) + return &out, nil +} + +type DynamicMemoryEnabled string + +const ( + DynamicMemoryEnabledFalse DynamicMemoryEnabled = "false" + DynamicMemoryEnabledTrue DynamicMemoryEnabled = "true" +) + +func PossibleValuesForDynamicMemoryEnabled() []string { + return []string{ + string(DynamicMemoryEnabledFalse), + string(DynamicMemoryEnabledTrue), + } +} + +func (s *DynamicMemoryEnabled) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDynamicMemoryEnabled(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDynamicMemoryEnabled(input string) (*DynamicMemoryEnabled, error) { + vals := map[string]DynamicMemoryEnabled{ + "false": DynamicMemoryEnabledFalse, + "true": DynamicMemoryEnabledTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicMemoryEnabled(input) + return &out, nil +} + +type Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type IsHighlyAvailable string + +const ( + IsHighlyAvailableFalse IsHighlyAvailable = "false" + IsHighlyAvailableTrue IsHighlyAvailable = "true" +) + +func PossibleValuesForIsHighlyAvailable() []string { + return []string{ + string(IsHighlyAvailableFalse), + string(IsHighlyAvailableTrue), + } +} + +func (s *IsHighlyAvailable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsHighlyAvailable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsHighlyAvailable(input string) (*IsHighlyAvailable, error) { + vals := map[string]IsHighlyAvailable{ + "false": IsHighlyAvailableFalse, + "true": IsHighlyAvailableTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsHighlyAvailable(input) + return &out, nil +} + +type LimitCPUForMigration string + +const ( + LimitCPUForMigrationFalse LimitCPUForMigration = "false" + LimitCPUForMigrationTrue LimitCPUForMigration = "true" +) + +func PossibleValuesForLimitCPUForMigration() []string { + return []string{ + string(LimitCPUForMigrationFalse), + string(LimitCPUForMigrationTrue), + } +} + +func (s *LimitCPUForMigration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLimitCPUForMigration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLimitCPUForMigration(input string) (*LimitCPUForMigration, error) { + vals := map[string]LimitCPUForMigration{ + "false": LimitCPUForMigrationFalse, + "true": LimitCPUForMigrationTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LimitCPUForMigration(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeOther OsType = "Other" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeOther), + string(OsTypeWindows), + } +} + +func (s *OsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOsType(input string) (*OsType, error) { + vals := map[string]OsType{ + "linux": OsTypeLinux, + "other": OsTypeOther, + "windows": OsTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OsType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 SkipShutdown string + +const ( + SkipShutdownFalse SkipShutdown = "false" + SkipShutdownTrue SkipShutdown = "true" +) + +func PossibleValuesForSkipShutdown() []string { + return []string{ + string(SkipShutdownFalse), + string(SkipShutdownTrue), + } +} + +func (s *SkipShutdown) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseSkipShutdown(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseSkipShutdown(input string) (*SkipShutdown, error) { + vals := map[string]SkipShutdown{ + "false": SkipShutdownFalse, + "true": SkipShutdownTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SkipShutdown(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go new file mode 100644 index 000000000000..10ad40383b7a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createcheckpoint.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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 CreateCheckpointOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateCheckpoint ... +func (c VirtualMachineInstancesClient) CreateCheckpoint(ctx context.Context, id commonids.ScopeId, input VirtualMachineCreateCheckpoint) (result CreateCheckpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/createCheckpoint", 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 +} + +// CreateCheckpointThenPoll performs CreateCheckpoint then polls until it's completed +func (c VirtualMachineInstancesClient) CreateCheckpointThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineCreateCheckpoint) error { + result, err := c.CreateCheckpoint(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateCheckpoint: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateCheckpoint: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go new file mode 100644 index 000000000000..dc5d3e8647da --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_createorupdate.go @@ -0,0 +1,75 @@ +package virtualmachineinstances + +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 +} + +// CreateOrUpdate ... +func (c VirtualMachineInstancesClient) CreateOrUpdate(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstance) (result CreateOrUpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default", 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 VirtualMachineInstancesClient) CreateOrUpdateThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstance) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go new file mode 100644 index 000000000000..a5b03734e588 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_delete.go @@ -0,0 +1,103 @@ +package virtualmachineinstances + +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 +} + +type DeleteOperationOptions struct { + DeleteFromHost *DeleteFromHost + Force *Force +} + +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.DeleteFromHost != nil { + out.Append("deleteFromHost", fmt.Sprintf("%v", *o.DeleteFromHost)) + } + if o.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VirtualMachineInstancesClient) Delete(ctx context.Context, id commonids.ScopeId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default", id.ID()), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineInstancesClient) DeleteThenPoll(ctx context.Context, id commonids.ScopeId, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go new file mode 100644 index 000000000000..b355bcd3c840 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_deletecheckpoint.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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 DeleteCheckpointOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// DeleteCheckpoint ... +func (c VirtualMachineInstancesClient) DeleteCheckpoint(ctx context.Context, id commonids.ScopeId, input VirtualMachineDeleteCheckpoint) (result DeleteCheckpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/deleteCheckpoint", 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 +} + +// DeleteCheckpointThenPoll performs DeleteCheckpoint then polls until it's completed +func (c VirtualMachineInstancesClient) DeleteCheckpointThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineDeleteCheckpoint) error { + result, err := c.DeleteCheckpoint(ctx, id, input) + if err != nil { + return fmt.Errorf("performing DeleteCheckpoint: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after DeleteCheckpoint: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go new file mode 100644 index 000000000000..409ceb486d9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_get.go @@ -0,0 +1,53 @@ +package virtualmachineinstances + +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 *VirtualMachineInstance +} + +// Get ... +func (c VirtualMachineInstancesClient) Get(ctx context.Context, id commonids.ScopeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go new file mode 100644 index 000000000000..60ea514a81ea --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_list.go @@ -0,0 +1,90 @@ +package virtualmachineinstances + +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 *[]VirtualMachineInstance +} + +type ListCompleteResult struct { + Items []VirtualMachineInstance +} + +// List ... +func (c VirtualMachineInstancesClient) List(ctx context.Context, id commonids.ScopeId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances", 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 *[]VirtualMachineInstance `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 VirtualMachineInstancesClient) ListComplete(ctx context.Context, id commonids.ScopeId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, VirtualMachineInstanceOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineInstancesClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate VirtualMachineInstanceOperationPredicate) (result ListCompleteResult, err error) { + items := make([]VirtualMachineInstance, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go new file mode 100644 index 000000000000..6d7dbeeaba48 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restart.go @@ -0,0 +1,70 @@ +package virtualmachineinstances + +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 VirtualMachineInstancesClient) Restart(ctx context.Context, id commonids.ScopeId) (result RestartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/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 VirtualMachineInstancesClient) RestartThenPoll(ctx context.Context, id commonids.ScopeId) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go new file mode 100644 index 000000000000..482733633552 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_restorecheckpoint.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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 RestoreCheckpointOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// RestoreCheckpoint ... +func (c VirtualMachineInstancesClient) RestoreCheckpoint(ctx context.Context, id commonids.ScopeId, input VirtualMachineRestoreCheckpoint) (result RestoreCheckpointOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/restoreCheckpoint", 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 +} + +// RestoreCheckpointThenPoll performs RestoreCheckpoint then polls until it's completed +func (c VirtualMachineInstancesClient) RestoreCheckpointThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineRestoreCheckpoint) error { + result, err := c.RestoreCheckpoint(ctx, id, input) + if err != nil { + return fmt.Errorf("performing RestoreCheckpoint: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after RestoreCheckpoint: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go new file mode 100644 index 000000000000..0ef71d0d7250 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_start.go @@ -0,0 +1,70 @@ +package virtualmachineinstances + +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 StartOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Start ... +func (c VirtualMachineInstancesClient) Start(ctx context.Context, id commonids.ScopeId) (result StartOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/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 VirtualMachineInstancesClient) StartThenPoll(ctx context.Context, id commonids.ScopeId) 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go new file mode 100644 index 000000000000..6f7f1e3cd31a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_stop.go @@ -0,0 +1,74 @@ +package virtualmachineinstances + +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 StopOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Stop ... +func (c VirtualMachineInstancesClient) Stop(ctx context.Context, id commonids.ScopeId, input StopVirtualMachineOptions) (result StopOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + }, + HttpMethod: http.MethodPost, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/stop", 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 +} + +// StopThenPoll performs Stop then polls until it's completed +func (c VirtualMachineInstancesClient) StopThenPoll(ctx context.Context, id commonids.ScopeId, input StopVirtualMachineOptions) error { + result, err := c.Stop(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Stop: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Stop: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go new file mode 100644 index 000000000000..a6f082325675 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/method_update.go @@ -0,0 +1,75 @@ +package virtualmachineinstances + +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 +} + +// Update ... +func (c VirtualMachineInstancesClient) Update(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstanceUpdate) (result UpdateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusOK, + }, + HttpMethod: http.MethodPatch, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default", 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 VirtualMachineInstancesClient) UpdateThenPoll(ctx context.Context, id commonids.ScopeId, input VirtualMachineInstanceUpdate) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go new file mode 100644 index 000000000000..eeee23b8d4bc --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_availabilitysetlistavailabilitysetsinlined.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AvailabilitySetListAvailabilitySetsInlined struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go new file mode 100644 index 000000000000..15a4dd74ae18 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_checkpoint.go @@ -0,0 +1,11 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type Checkpoint struct { + CheckpointID *string `json:"checkpointID,omitempty"` + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` + ParentCheckpointID *string `json:"parentCheckpointID,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go new file mode 100644 index 000000000000..a86814d6f629 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_extendedlocation.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go new file mode 100644 index 000000000000..1d9b975390c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofile.go @@ -0,0 +1,14 @@ +package virtualmachineinstances + +// 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 { + CpuCount *int64 `json:"cpuCount,omitempty"` + DynamicMemoryEnabled *DynamicMemoryEnabled `json:"dynamicMemoryEnabled,omitempty"` + DynamicMemoryMaxMB *int64 `json:"dynamicMemoryMaxMB,omitempty"` + DynamicMemoryMinMB *int64 `json:"dynamicMemoryMinMB,omitempty"` + IsHighlyAvailable *IsHighlyAvailable `json:"isHighlyAvailable,omitempty"` + LimitCPUForMigration *LimitCPUForMigration `json:"limitCpuForMigration,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go new file mode 100644 index 000000000000..b94c91c58b0b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_hardwareprofileupdate.go @@ -0,0 +1,13 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HardwareProfileUpdate struct { + CpuCount *int64 `json:"cpuCount,omitempty"` + DynamicMemoryEnabled *DynamicMemoryEnabled `json:"dynamicMemoryEnabled,omitempty"` + DynamicMemoryMaxMB *int64 `json:"dynamicMemoryMaxMB,omitempty"` + DynamicMemoryMinMB *int64 `json:"dynamicMemoryMinMB,omitempty"` + LimitCPUForMigration *LimitCPUForMigration `json:"limitCpuForMigration,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go new file mode 100644 index 000000000000..22fac2ad6808 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofile.go @@ -0,0 +1,18 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InfrastructureProfile struct { + BiosGuid *string `json:"biosGuid,omitempty"` + CheckpointType *string `json:"checkpointType,omitempty"` + Checkpoints *[]Checkpoint `json:"checkpoints,omitempty"` + CloudId *string `json:"cloudId,omitempty"` + Generation *int64 `json:"generation,omitempty"` + InventoryItemId *string `json:"inventoryItemId,omitempty"` + LastRestoredVMCheckpoint *Checkpoint `json:"lastRestoredVMCheckpoint,omitempty"` + TemplateId *string `json:"templateId,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` + VirtualMachineName *string `json:"vmName,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go new file mode 100644 index 000000000000..dc63b0086fec --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_infrastructureprofileupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type InfrastructureProfileUpdate struct { + CheckpointType *string `json:"checkpointType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go new file mode 100644 index 000000000000..5bd4c50160ad --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterface.go @@ -0,0 +1,18 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterface struct { + DisplayName *string `json:"displayName,omitempty"` + IPv4AddressType *AllocationMethod `json:"ipv4AddressType,omitempty"` + IPv4Addresses *[]string `json:"ipv4Addresses,omitempty"` + IPv6AddressType *AllocationMethod `json:"ipv6AddressType,omitempty"` + IPv6Addresses *[]string `json:"ipv6Addresses,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + MacAddressType *AllocationMethod `json:"macAddressType,omitempty"` + Name *string `json:"name,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + NicId *string `json:"nicId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go new file mode 100644 index 000000000000..5c00dd7add31 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkinterfaceupdate.go @@ -0,0 +1,14 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterfaceUpdate struct { + IPv4AddressType *AllocationMethod `json:"ipv4AddressType,omitempty"` + IPv6AddressType *AllocationMethod `json:"ipv6AddressType,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + MacAddressType *AllocationMethod `json:"macAddressType,omitempty"` + Name *string `json:"name,omitempty"` + NicId *string `json:"nicId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go new file mode 100644 index 000000000000..b1085e716f8e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofile.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// 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 { + NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go new file mode 100644 index 000000000000..dcc323d7f683 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_networkprofileupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkProfileUpdate struct { + NetworkInterfaces *[]NetworkInterfaceUpdate `json:"networkInterfaces,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go new file mode 100644 index 000000000000..e1837a1b7c9b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_osprofileforvminstance.go @@ -0,0 +1,12 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type OsProfileForVMInstance struct { + AdminPassword *string `json:"adminPassword,omitempty"` + ComputerName *string `json:"computerName,omitempty"` + OsSku *string `json:"osSku,omitempty"` + OsType *OsType `json:"osType,omitempty"` + OsVersion *string `json:"osVersion,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go new file mode 100644 index 000000000000..5d7c04bfd445 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_stopvirtualmachineoptions.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StopVirtualMachineOptions struct { + SkipShutdown *SkipShutdown `json:"skipShutdown,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go new file mode 100644 index 000000000000..1fcda71bf221 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofile.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// 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 { + Disks *[]VirtualDisk `json:"disks,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go new file mode 100644 index 000000000000..c9b1f05dc0c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageprofileupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageProfileUpdate struct { + Disks *[]VirtualDiskUpdate `json:"disks,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go new file mode 100644 index 000000000000..4b919e02a871 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_storageqospolicydetails.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageQoSPolicyDetails struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go new file mode 100644 index 000000000000..ffd700958da0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdisk.go @@ -0,0 +1,21 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualDisk struct { + Bus *int64 `json:"bus,omitempty"` + BusType *string `json:"busType,omitempty"` + CreateDiffDisk *CreateDiffDisk `json:"createDiffDisk,omitempty"` + DiskId *string `json:"diskId,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Lun *int64 `json:"lun,omitempty"` + MaxDiskSizeGB *int64 `json:"maxDiskSizeGB,omitempty"` + Name *string `json:"name,omitempty"` + StorageQoSPolicy *StorageQoSPolicyDetails `json:"storageQoSPolicy,omitempty"` + TemplateDiskId *string `json:"templateDiskId,omitempty"` + VhdFormatType *string `json:"vhdFormatType,omitempty"` + VhdType *string `json:"vhdType,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go new file mode 100644 index 000000000000..49d92b465d7d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualdiskupdate.go @@ -0,0 +1,15 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualDiskUpdate struct { + Bus *int64 `json:"bus,omitempty"` + BusType *string `json:"busType,omitempty"` + DiskId *string `json:"diskId,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + Lun *int64 `json:"lun,omitempty"` + Name *string `json:"name,omitempty"` + StorageQoSPolicy *StorageQoSPolicyDetails `json:"storageQoSPolicy,omitempty"` + VhdType *string `json:"vhdType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go new file mode 100644 index 000000000000..162ee0cfa4c2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinecreatecheckpoint.go @@ -0,0 +1,9 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineCreateCheckpoint struct { + Description *string `json:"description,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go new file mode 100644 index 000000000000..71ab42fa81b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinedeletecheckpoint.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineDeleteCheckpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go new file mode 100644 index 000000000000..22578153c53a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstance.go @@ -0,0 +1,17 @@ +package virtualmachineinstances + +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 VirtualMachineInstance struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties VirtualMachineInstanceProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go new file mode 100644 index 000000000000..b8549a4145e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceproperties.go @@ -0,0 +1,15 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceProperties struct { + AvailabilitySets *[]AvailabilitySetListAvailabilitySetsInlined `json:"availabilitySets,omitempty"` + HardwareProfile *HardwareProfile `json:"hardwareProfile,omitempty"` + InfrastructureProfile *InfrastructureProfile `json:"infrastructureProfile,omitempty"` + NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + OsProfile *OsProfileForVMInstance `json:"osProfile,omitempty"` + PowerState *string `json:"powerState,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + StorageProfile *StorageProfile `json:"storageProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go new file mode 100644 index 000000000000..f95bd091276e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdate.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceUpdate struct { + Properties *VirtualMachineInstanceUpdateProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go new file mode 100644 index 000000000000..de7604d85c4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachineinstanceupdateproperties.go @@ -0,0 +1,12 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceUpdateProperties struct { + AvailabilitySets *[]AvailabilitySetListAvailabilitySetsInlined `json:"availabilitySets,omitempty"` + HardwareProfile *HardwareProfileUpdate `json:"hardwareProfile,omitempty"` + InfrastructureProfile *InfrastructureProfileUpdate `json:"infrastructureProfile,omitempty"` + NetworkProfile *NetworkProfileUpdate `json:"networkProfile,omitempty"` + StorageProfile *StorageProfileUpdate `json:"storageProfile,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go new file mode 100644 index 000000000000..43279778e524 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/model_virtualmachinerestorecheckpoint.go @@ -0,0 +1,8 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineRestoreCheckpoint struct { + Id *string `json:"id,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go new file mode 100644 index 000000000000..e4d7d84f3570 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/predicates.go @@ -0,0 +1,27 @@ +package virtualmachineinstances + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineInstanceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VirtualMachineInstanceOperationPredicate) Matches(input VirtualMachineInstance) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go new file mode 100644 index 000000000000..ff7feb152741 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances/version.go @@ -0,0 +1,12 @@ +package virtualmachineinstances + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualmachineinstances/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md new file mode 100644 index 000000000000..b945813c38be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates` Documentation + +The `virtualmachinetemplates` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates" +``` + + +### Client Initialization + +```go +client := virtualmachinetemplates.NewVirtualMachineTemplatesClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualMachineTemplatesClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +payload := virtualmachinetemplates.VirtualMachineTemplate{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineTemplatesClient.Delete` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +if err := client.DeleteThenPoll(ctx, id, virtualmachinetemplates.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualMachineTemplatesClient.Get` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +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: `VirtualMachineTemplatesClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.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: `VirtualMachineTemplatesClient.ListBySubscription` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.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: `VirtualMachineTemplatesClient.Update` + +```go +ctx := context.TODO() +id := virtualmachinetemplates.NewVirtualMachineTemplateID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualMachineTemplateValue") + +payload := virtualmachinetemplates.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go new file mode 100644 index 000000000000..12c5314c789e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/client.go @@ -0,0 +1,26 @@ +package virtualmachinetemplates + +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 VirtualMachineTemplatesClient struct { + Client *resourcemanager.Client +} + +func NewVirtualMachineTemplatesClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualMachineTemplatesClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualmachinetemplates", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualMachineTemplatesClient: %+v", err) + } + + return &VirtualMachineTemplatesClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go new file mode 100644 index 000000000000..a3405ff11e2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/constants.go @@ -0,0 +1,400 @@ +package virtualmachinetemplates + +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 AllocationMethod string + +const ( + AllocationMethodDynamic AllocationMethod = "Dynamic" + AllocationMethodStatic AllocationMethod = "Static" +) + +func PossibleValuesForAllocationMethod() []string { + return []string{ + string(AllocationMethodDynamic), + string(AllocationMethodStatic), + } +} + +func (s *AllocationMethod) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseAllocationMethod(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseAllocationMethod(input string) (*AllocationMethod, error) { + vals := map[string]AllocationMethod{ + "dynamic": AllocationMethodDynamic, + "static": AllocationMethodStatic, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AllocationMethod(input) + return &out, nil +} + +type CreateDiffDisk string + +const ( + CreateDiffDiskFalse CreateDiffDisk = "false" + CreateDiffDiskTrue CreateDiffDisk = "true" +) + +func PossibleValuesForCreateDiffDisk() []string { + return []string{ + string(CreateDiffDiskFalse), + string(CreateDiffDiskTrue), + } +} + +func (s *CreateDiffDisk) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseCreateDiffDisk(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseCreateDiffDisk(input string) (*CreateDiffDisk, error) { + vals := map[string]CreateDiffDisk{ + "false": CreateDiffDiskFalse, + "true": CreateDiffDiskTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := CreateDiffDisk(input) + return &out, nil +} + +type DynamicMemoryEnabled string + +const ( + DynamicMemoryEnabledFalse DynamicMemoryEnabled = "false" + DynamicMemoryEnabledTrue DynamicMemoryEnabled = "true" +) + +func PossibleValuesForDynamicMemoryEnabled() []string { + return []string{ + string(DynamicMemoryEnabledFalse), + string(DynamicMemoryEnabledTrue), + } +} + +func (s *DynamicMemoryEnabled) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseDynamicMemoryEnabled(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseDynamicMemoryEnabled(input string) (*DynamicMemoryEnabled, error) { + vals := map[string]DynamicMemoryEnabled{ + "false": DynamicMemoryEnabledFalse, + "true": DynamicMemoryEnabledTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := DynamicMemoryEnabled(input) + return &out, nil +} + +type Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type IsCustomizable string + +const ( + IsCustomizableFalse IsCustomizable = "false" + IsCustomizableTrue IsCustomizable = "true" +) + +func PossibleValuesForIsCustomizable() []string { + return []string{ + string(IsCustomizableFalse), + string(IsCustomizableTrue), + } +} + +func (s *IsCustomizable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsCustomizable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsCustomizable(input string) (*IsCustomizable, error) { + vals := map[string]IsCustomizable{ + "false": IsCustomizableFalse, + "true": IsCustomizableTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsCustomizable(input) + return &out, nil +} + +type IsHighlyAvailable string + +const ( + IsHighlyAvailableFalse IsHighlyAvailable = "false" + IsHighlyAvailableTrue IsHighlyAvailable = "true" +) + +func PossibleValuesForIsHighlyAvailable() []string { + return []string{ + string(IsHighlyAvailableFalse), + string(IsHighlyAvailableTrue), + } +} + +func (s *IsHighlyAvailable) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseIsHighlyAvailable(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseIsHighlyAvailable(input string) (*IsHighlyAvailable, error) { + vals := map[string]IsHighlyAvailable{ + "false": IsHighlyAvailableFalse, + "true": IsHighlyAvailableTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := IsHighlyAvailable(input) + return &out, nil +} + +type LimitCPUForMigration string + +const ( + LimitCPUForMigrationFalse LimitCPUForMigration = "false" + LimitCPUForMigrationTrue LimitCPUForMigration = "true" +) + +func PossibleValuesForLimitCPUForMigration() []string { + return []string{ + string(LimitCPUForMigrationFalse), + string(LimitCPUForMigrationTrue), + } +} + +func (s *LimitCPUForMigration) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseLimitCPUForMigration(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseLimitCPUForMigration(input string) (*LimitCPUForMigration, error) { + vals := map[string]LimitCPUForMigration{ + "false": LimitCPUForMigrationFalse, + "true": LimitCPUForMigrationTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := LimitCPUForMigration(input) + return &out, nil +} + +type OsType string + +const ( + OsTypeLinux OsType = "Linux" + OsTypeOther OsType = "Other" + OsTypeWindows OsType = "Windows" +) + +func PossibleValuesForOsType() []string { + return []string{ + string(OsTypeLinux), + string(OsTypeOther), + string(OsTypeWindows), + } +} + +func (s *OsType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseOsType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseOsType(input string) (*OsType, error) { + vals := map[string]OsType{ + "linux": OsTypeLinux, + "other": OsTypeOther, + "windows": OsTypeWindows, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := OsType(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go new file mode 100644 index 000000000000..5b723986aad5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go @@ -0,0 +1,127 @@ +package virtualmachinetemplates + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = VirtualMachineTemplateId{} + +// VirtualMachineTemplateId is a struct representing the Resource ID for a Virtual Machine Template +type VirtualMachineTemplateId struct { + SubscriptionId string + ResourceGroupName string + VirtualMachineTemplateName string +} + +// NewVirtualMachineTemplateID returns a new VirtualMachineTemplateId struct +func NewVirtualMachineTemplateID(subscriptionId string, resourceGroupName string, virtualMachineTemplateName string) VirtualMachineTemplateId { + return VirtualMachineTemplateId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualMachineTemplateName: virtualMachineTemplateName, + } +} + +// ParseVirtualMachineTemplateID parses 'input' into a VirtualMachineTemplateId +func ParseVirtualMachineTemplateID(input string) (*VirtualMachineTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineTemplateId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineTemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + } + + return &id, nil +} + +// ParseVirtualMachineTemplateIDInsensitively parses 'input' case-insensitively into a VirtualMachineTemplateId +// note: this method should only be used for API response data and not user input +func ParseVirtualMachineTemplateIDInsensitively(input string) (*VirtualMachineTemplateId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualMachineTemplateId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualMachineTemplateId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + } + + return &id, nil +} + +// ValidateVirtualMachineTemplateID checks that 'input' can be parsed as a Virtual Machine Template ID +func ValidateVirtualMachineTemplateID(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 := ParseVirtualMachineTemplateID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Machine Template ID +func (id VirtualMachineTemplateId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/virtualMachineTemplates/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualMachineTemplateName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Machine Template ID +func (id VirtualMachineTemplateId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVirtualMachineTemplates", "virtualMachineTemplates", "virtualMachineTemplates"), + resourceids.UserSpecifiedSegment("virtualMachineTemplateName", "virtualMachineTemplateValue"), + } +} + +// String returns a human-readable description of this Virtual Machine Template ID +func (id VirtualMachineTemplateId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Machine Template Name: %q", id.VirtualMachineTemplateName), + } + return fmt.Sprintf("Virtual Machine Template (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go new file mode 100644 index 000000000000..73838ea80a2e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_createorupdate.go @@ -0,0 +1,74 @@ +package virtualmachinetemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c VirtualMachineTemplatesClient) CreateOrUpdate(ctx context.Context, id VirtualMachineTemplateId, input VirtualMachineTemplate) (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 VirtualMachineTemplatesClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualMachineTemplateId, input VirtualMachineTemplate) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go new file mode 100644 index 000000000000..98efca73c621 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_delete.go @@ -0,0 +1,98 @@ +package virtualmachinetemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/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 { + Force *Force +} + +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.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VirtualMachineTemplatesClient) Delete(ctx context.Context, id VirtualMachineTemplateId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualMachineTemplatesClient) DeleteThenPoll(ctx context.Context, id VirtualMachineTemplateId, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go new file mode 100644 index 000000000000..c5baf634da30 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_get.go @@ -0,0 +1,51 @@ +package virtualmachinetemplates + +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 *VirtualMachineTemplate +} + +// Get ... +func (c VirtualMachineTemplatesClient) Get(ctx context.Context, id VirtualMachineTemplateId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go new file mode 100644 index 000000000000..251bf07ca7b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package virtualmachinetemplates + +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 *[]VirtualMachineTemplate +} + +type ListByResourceGroupCompleteResult struct { + Items []VirtualMachineTemplate +} + +// ListByResourceGroup ... +func (c VirtualMachineTemplatesClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineTemplates", 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 *[]VirtualMachineTemplate `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 VirtualMachineTemplatesClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VirtualMachineTemplateOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineTemplatesClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualMachineTemplateOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VirtualMachineTemplate, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go new file mode 100644 index 000000000000..727516da0f13 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_listbysubscription.go @@ -0,0 +1,90 @@ +package virtualmachinetemplates + +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 *[]VirtualMachineTemplate +} + +type ListBySubscriptionCompleteResult struct { + Items []VirtualMachineTemplate +} + +// ListBySubscription ... +func (c VirtualMachineTemplatesClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineTemplates", 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 *[]VirtualMachineTemplate `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 VirtualMachineTemplatesClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VirtualMachineTemplateOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualMachineTemplatesClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualMachineTemplateOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VirtualMachineTemplate, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go new file mode 100644 index 000000000000..c23f8763b26e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/method_update.go @@ -0,0 +1,74 @@ +package virtualmachinetemplates + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c VirtualMachineTemplatesClient) Update(ctx context.Context, id VirtualMachineTemplateId, input ResourcePatch) (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 VirtualMachineTemplatesClient) UpdateThenPoll(ctx context.Context, id VirtualMachineTemplateId, input ResourcePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go new file mode 100644 index 000000000000..7be44f383732 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_extendedlocation.go @@ -0,0 +1,9 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go new file mode 100644 index 000000000000..48a373dc3882 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_networkinterface.go @@ -0,0 +1,18 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type NetworkInterface struct { + DisplayName *string `json:"displayName,omitempty"` + IPv4AddressType *AllocationMethod `json:"ipv4AddressType,omitempty"` + IPv4Addresses *[]string `json:"ipv4Addresses,omitempty"` + IPv6AddressType *AllocationMethod `json:"ipv6AddressType,omitempty"` + IPv6Addresses *[]string `json:"ipv6Addresses,omitempty"` + MacAddress *string `json:"macAddress,omitempty"` + MacAddressType *AllocationMethod `json:"macAddressType,omitempty"` + Name *string `json:"name,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + NicId *string `json:"nicId,omitempty"` + VirtualNetworkId *string `json:"virtualNetworkId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go new file mode 100644 index 000000000000..9158fc48b415 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_resourcepatch.go @@ -0,0 +1,8 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go new file mode 100644 index 000000000000..e39a41230bc3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_storageqospolicydetails.go @@ -0,0 +1,9 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type StorageQoSPolicyDetails struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go new file mode 100644 index 000000000000..ba2d57b6dc34 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualdisk.go @@ -0,0 +1,21 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualDisk struct { + Bus *int64 `json:"bus,omitempty"` + BusType *string `json:"busType,omitempty"` + CreateDiffDisk *CreateDiffDisk `json:"createDiffDisk,omitempty"` + DiskId *string `json:"diskId,omitempty"` + DiskSizeGB *int64 `json:"diskSizeGB,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + Lun *int64 `json:"lun,omitempty"` + MaxDiskSizeGB *int64 `json:"maxDiskSizeGB,omitempty"` + Name *string `json:"name,omitempty"` + StorageQoSPolicy *StorageQoSPolicyDetails `json:"storageQoSPolicy,omitempty"` + TemplateDiskId *string `json:"templateDiskId,omitempty"` + VhdFormatType *string `json:"vhdFormatType,omitempty"` + VhdType *string `json:"vhdType,omitempty"` + VolumeType *string `json:"volumeType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go new file mode 100644 index 000000000000..d7b80cd73821 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplate.go @@ -0,0 +1,19 @@ +package virtualmachinetemplates + +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 VirtualMachineTemplate struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VirtualMachineTemplateProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go new file mode 100644 index 000000000000..9e470ff000a7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/model_virtualmachinetemplateproperties.go @@ -0,0 +1,25 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineTemplateProperties struct { + ComputerName *string `json:"computerName,omitempty"` + CpuCount *int64 `json:"cpuCount,omitempty"` + Disks *[]VirtualDisk `json:"disks,omitempty"` + DynamicMemoryEnabled *DynamicMemoryEnabled `json:"dynamicMemoryEnabled,omitempty"` + DynamicMemoryMaxMB *int64 `json:"dynamicMemoryMaxMB,omitempty"` + DynamicMemoryMinMB *int64 `json:"dynamicMemoryMinMB,omitempty"` + Generation *int64 `json:"generation,omitempty"` + InventoryItemId *string `json:"inventoryItemId,omitempty"` + IsCustomizable *IsCustomizable `json:"isCustomizable,omitempty"` + IsHighlyAvailable *IsHighlyAvailable `json:"isHighlyAvailable,omitempty"` + LimitCPUForMigration *LimitCPUForMigration `json:"limitCpuForMigration,omitempty"` + MemoryMB *int64 `json:"memoryMB,omitempty"` + NetworkInterfaces *[]NetworkInterface `json:"networkInterfaces,omitempty"` + OsName *string `json:"osName,omitempty"` + OsType *OsType `json:"osType,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go new file mode 100644 index 000000000000..89c36171228e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/predicates.go @@ -0,0 +1,32 @@ +package virtualmachinetemplates + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualMachineTemplateOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualMachineTemplateOperationPredicate) Matches(input VirtualMachineTemplate) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go new file mode 100644 index 000000000000..719a261728d0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/version.go @@ -0,0 +1,12 @@ +package virtualmachinetemplates + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualmachinetemplates/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md new file mode 100644 index 000000000000..a3f6730d05e7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks` Documentation + +The `virtualnetworks` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks" +``` + + +### Client Initialization + +```go +client := virtualnetworks.NewVirtualNetworksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VirtualNetworksClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +payload := virtualnetworks.VirtualNetwork{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Delete` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +if err := client.DeleteThenPoll(ctx, id, virtualnetworks.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VirtualNetworksClient.Get` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +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: `VirtualNetworksClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := virtualnetworks.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: `VirtualNetworksClient.ListBySubscription` + +```go +ctx := context.TODO() +id := virtualnetworks.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: `VirtualNetworksClient.Update` + +```go +ctx := context.TODO() +id := virtualnetworks.NewVirtualNetworkID("12345678-1234-9876-4563-123456789012", "example-resource-group", "virtualNetworkValue") + +payload := virtualnetworks.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go new file mode 100644 index 000000000000..15c346279f67 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/client.go @@ -0,0 +1,26 @@ +package virtualnetworks + +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 VirtualNetworksClient struct { + Client *resourcemanager.Client +} + +func NewVirtualNetworksClientWithBaseURI(sdkApi sdkEnv.Api) (*VirtualNetworksClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "virtualnetworks", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VirtualNetworksClient: %+v", err) + } + + return &VirtualNetworksClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go new file mode 100644 index 000000000000..351afacd3d60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/constants.go @@ -0,0 +1,110 @@ +package virtualnetworks + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go new file mode 100644 index 000000000000..2b3547af7032 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go @@ -0,0 +1,127 @@ +package virtualnetworks + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = VirtualNetworkId{} + +// VirtualNetworkId is a struct representing the Resource ID for a Virtual Network +type VirtualNetworkId struct { + SubscriptionId string + ResourceGroupName string + VirtualNetworkName string +} + +// NewVirtualNetworkID returns a new VirtualNetworkId struct +func NewVirtualNetworkID(subscriptionId string, resourceGroupName string, virtualNetworkName string) VirtualNetworkId { + return VirtualNetworkId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VirtualNetworkName: virtualNetworkName, + } +} + +// ParseVirtualNetworkID parses 'input' into a VirtualNetworkId +func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + } + + return &id, nil +} + +// ParseVirtualNetworkIDInsensitively parses 'input' case-insensitively into a VirtualNetworkId +// note: this method should only be used for API response data and not user input +func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) { + parser := resourceids.NewParserFromResourceIdType(VirtualNetworkId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VirtualNetworkId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + } + + return &id, nil +} + +// ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID +func ValidateVirtualNetworkID(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 := ParseVirtualNetworkID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Virtual Network ID +func (id VirtualNetworkId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/virtualNetworks/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VirtualNetworkName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Virtual Network ID +func (id VirtualNetworkId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVirtualNetworks", "virtualNetworks", "virtualNetworks"), + resourceids.UserSpecifiedSegment("virtualNetworkName", "virtualNetworkValue"), + } +} + +// String returns a human-readable description of this Virtual Network ID +func (id VirtualNetworkId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Virtual Network Name: %q", id.VirtualNetworkName), + } + return fmt.Sprintf("Virtual Network (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go new file mode 100644 index 000000000000..1db606260864 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_createorupdate.go @@ -0,0 +1,74 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c VirtualNetworksClient) CreateOrUpdate(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) (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 VirtualNetworksClient) CreateOrUpdateThenPoll(ctx context.Context, id VirtualNetworkId, input VirtualNetwork) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go new file mode 100644 index 000000000000..01a9c4496d60 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_delete.go @@ -0,0 +1,98 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/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 { + Force *Force +} + +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.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VirtualNetworksClient) Delete(ctx context.Context, id VirtualNetworkId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VirtualNetworksClient) DeleteThenPoll(ctx context.Context, id VirtualNetworkId, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go new file mode 100644 index 000000000000..479941ebdb3b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_get.go @@ -0,0 +1,51 @@ +package virtualnetworks + +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 *VirtualNetwork +} + +// Get ... +func (c VirtualNetworksClient) Get(ctx context.Context, id VirtualNetworkId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go new file mode 100644 index 000000000000..fbd2e3549f29 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package virtualnetworks + +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 *[]VirtualNetwork +} + +type ListByResourceGroupCompleteResult struct { + Items []VirtualNetwork +} + +// ListByResourceGroup ... +func (c VirtualNetworksClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualNetworks", 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 *[]VirtualNetwork `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 VirtualNetworksClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VirtualNetworkOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworksClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VirtualNetworkOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VirtualNetwork, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go new file mode 100644 index 000000000000..0a396c5cbc87 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_listbysubscription.go @@ -0,0 +1,90 @@ +package virtualnetworks + +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 *[]VirtualNetwork +} + +type ListBySubscriptionCompleteResult struct { + Items []VirtualNetwork +} + +// ListBySubscription ... +func (c VirtualNetworksClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualNetworks", 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 *[]VirtualNetwork `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 VirtualNetworksClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VirtualNetworkOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VirtualNetworksClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VirtualNetworkOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VirtualNetwork, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go new file mode 100644 index 000000000000..bbaaaa799c09 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/method_update.go @@ -0,0 +1,74 @@ +package virtualnetworks + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c VirtualNetworksClient) Update(ctx context.Context, id VirtualNetworkId, input ResourcePatch) (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 VirtualNetworksClient) UpdateThenPoll(ctx context.Context, id VirtualNetworkId, input ResourcePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go new file mode 100644 index 000000000000..a3a28fb038c9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_extendedlocation.go @@ -0,0 +1,9 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go new file mode 100644 index 000000000000..b8e4e3ef99a5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_resourcepatch.go @@ -0,0 +1,8 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go new file mode 100644 index 000000000000..9ac2cb963907 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetwork.go @@ -0,0 +1,19 @@ +package virtualnetworks + +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 VirtualNetwork struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VirtualNetworkProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go new file mode 100644 index 000000000000..11c6f71f8ded --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/model_virtualnetworkproperties.go @@ -0,0 +1,12 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkProperties struct { + InventoryItemId *string `json:"inventoryItemId,omitempty"` + NetworkName *string `json:"networkName,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` + VMmServerId *string `json:"vmmServerId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go new file mode 100644 index 000000000000..34e415f32c22 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/predicates.go @@ -0,0 +1,32 @@ +package virtualnetworks + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VirtualNetworkOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VirtualNetworkOperationPredicate) Matches(input VirtualNetwork) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go new file mode 100644 index 000000000000..da76573b44dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/version.go @@ -0,0 +1,12 @@ +package virtualnetworks + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/virtualnetworks/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md new file mode 100644 index 000000000000..b0c4d0c79438 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/README.md @@ -0,0 +1,86 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents` Documentation + +The `vminstanceguestagents` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents" +``` + + +### Client Initialization + +```go +client := vminstanceguestagents.NewVMInstanceGuestAgentsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VMInstanceGuestAgentsClient.Create` + +```go +ctx := context.TODO() +id := vminstanceguestagents.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +payload := vminstanceguestagents.GuestAgent{ + // ... +} + + +if err := client.CreateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VMInstanceGuestAgentsClient.Delete` + +```go +ctx := context.TODO() +id := vminstanceguestagents.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +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: `VMInstanceGuestAgentsClient.Get` + +```go +ctx := context.TODO() +id := vminstanceguestagents.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +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: `VMInstanceGuestAgentsClient.List` + +```go +ctx := context.TODO() +id := vminstanceguestagents.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-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 +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go new file mode 100644 index 000000000000..c50f66637063 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/client.go @@ -0,0 +1,26 @@ +package vminstanceguestagents + +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 VMInstanceGuestAgentsClient struct { + Client *resourcemanager.Client +} + +func NewVMInstanceGuestAgentsClientWithBaseURI(sdkApi sdkEnv.Api) (*VMInstanceGuestAgentsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vminstanceguestagents", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VMInstanceGuestAgentsClient: %+v", err) + } + + return &VMInstanceGuestAgentsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go new file mode 100644 index 000000000000..03950ff6bc5a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/constants.go @@ -0,0 +1,113 @@ +package vminstanceguestagents + +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 ProvisioningAction string + +const ( + ProvisioningActionInstall ProvisioningAction = "install" + ProvisioningActionRepair ProvisioningAction = "repair" + ProvisioningActionUninstall ProvisioningAction = "uninstall" +) + +func PossibleValuesForProvisioningAction() []string { + return []string{ + string(ProvisioningActionInstall), + string(ProvisioningActionRepair), + string(ProvisioningActionUninstall), + } +} + +func (s *ProvisioningAction) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseProvisioningAction(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseProvisioningAction(input string) (*ProvisioningAction, error) { + vals := map[string]ProvisioningAction{ + "install": ProvisioningActionInstall, + "repair": ProvisioningActionRepair, + "uninstall": ProvisioningActionUninstall, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ProvisioningAction(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go new file mode 100644 index 000000000000..a07cd066be32 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_create.go @@ -0,0 +1,75 @@ +package vminstanceguestagents + +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 CreateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Create ... +func (c VMInstanceGuestAgentsClient) Create(ctx context.Context, id commonids.ScopeId, input GuestAgent) (result CreateOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusCreated, + http.StatusOK, + }, + HttpMethod: http.MethodPut, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", 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 VMInstanceGuestAgentsClient) CreateThenPoll(ctx context.Context, id commonids.ScopeId, input GuestAgent) error { + result, err := c.Create(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Create: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Create: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go new file mode 100644 index 000000000000..a71146bce61b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_delete.go @@ -0,0 +1,49 @@ +package vminstanceguestagents + +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 DeleteOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData +} + +// Delete ... +func (c VMInstanceGuestAgentsClient) Delete(ctx context.Context, id commonids.ScopeId) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusNoContent, + http.StatusOK, + }, + HttpMethod: http.MethodDelete, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go new file mode 100644 index 000000000000..d849d2789f69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_get.go @@ -0,0 +1,53 @@ +package vminstanceguestagents + +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 *GuestAgent +} + +// Get ... +func (c VMInstanceGuestAgentsClient) Get(ctx context.Context, id commonids.ScopeId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go new file mode 100644 index 000000000000..b0e54e24c31f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/method_list.go @@ -0,0 +1,90 @@ +package vminstanceguestagents + +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 *[]GuestAgent +} + +type ListCompleteResult struct { + Items []GuestAgent +} + +// List ... +func (c VMInstanceGuestAgentsClient) List(ctx context.Context, id commonids.ScopeId) (result ListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/guestAgents", 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 *[]GuestAgent `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 VMInstanceGuestAgentsClient) ListComplete(ctx context.Context, id commonids.ScopeId) (ListCompleteResult, error) { + return c.ListCompleteMatchingPredicate(ctx, id, GuestAgentOperationPredicate{}) +} + +// ListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMInstanceGuestAgentsClient) ListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate GuestAgentOperationPredicate) (result ListCompleteResult, err error) { + items := make([]GuestAgent, 0) + + resp, err := c.List(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go new file mode 100644 index 000000000000..195f7e64aaed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagent.go @@ -0,0 +1,16 @@ +package vminstanceguestagents + +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 GuestAgent struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties GuestAgentProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go new file mode 100644 index 000000000000..7f01590b94f8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestagentproperties.go @@ -0,0 +1,14 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestAgentProperties struct { + Credentials *GuestCredential `json:"credentials,omitempty"` + CustomResourceName *string `json:"customResourceName,omitempty"` + HTTPProxyConfig *HTTPProxyConfiguration `json:"httpProxyConfig,omitempty"` + ProvisioningAction *ProvisioningAction `json:"provisioningAction,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Status *string `json:"status,omitempty"` + Uuid *string `json:"uuid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go new file mode 100644 index 000000000000..4d4b3bdfa33a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_guestcredential.go @@ -0,0 +1,9 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestCredential struct { + Password string `json:"password"` + Username string `json:"username"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go new file mode 100644 index 000000000000..bc2cbf6e7769 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/model_httpproxyconfiguration.go @@ -0,0 +1,8 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type HTTPProxyConfiguration struct { + HTTPSProxy *string `json:"httpsProxy,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go new file mode 100644 index 000000000000..748083659003 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/predicates.go @@ -0,0 +1,27 @@ +package vminstanceguestagents + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type GuestAgentOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p GuestAgentOperationPredicate) Matches(input GuestAgent) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go new file mode 100644 index 000000000000..1b2f08a3bd16 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents/version.go @@ -0,0 +1,12 @@ +package vminstanceguestagents + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vminstanceguestagents/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md new file mode 100644 index 000000000000..f75ff0643aed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/README.md @@ -0,0 +1,53 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata` Documentation + +The `vminstancehybrididentitymetadata` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata" +``` + + +### Client Initialization + +```go +client := vminstancehybrididentitymetadata.NewVMInstanceHybridIdentityMetadataClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VMInstanceHybridIdentityMetadataClient.VirtualMachineInstanceHybridIdentityMetadataGet` + +```go +ctx := context.TODO() +id := vminstancehybrididentitymetadata.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +read, err := client.VirtualMachineInstanceHybridIdentityMetadataGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `VMInstanceHybridIdentityMetadataClient.VirtualMachineInstanceHybridIdentityMetadataList` + +```go +ctx := context.TODO() +id := vminstancehybrididentitymetadata.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.VirtualMachineInstanceHybridIdentityMetadataList(ctx, id)` can be used to do batched pagination +items, err := client.VirtualMachineInstanceHybridIdentityMetadataListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go new file mode 100644 index 000000000000..605e66135cb9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/client.go @@ -0,0 +1,26 @@ +package vminstancehybrididentitymetadata + +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 VMInstanceHybridIdentityMetadataClient struct { + Client *resourcemanager.Client +} + +func NewVMInstanceHybridIdentityMetadataClientWithBaseURI(sdkApi sdkEnv.Api) (*VMInstanceHybridIdentityMetadataClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vminstancehybrididentitymetadata", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VMInstanceHybridIdentityMetadataClient: %+v", err) + } + + return &VMInstanceHybridIdentityMetadataClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go new file mode 100644 index 000000000000..09f22289913c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/constants.go @@ -0,0 +1,69 @@ +package vminstancehybrididentitymetadata + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go new file mode 100644 index 000000000000..d24b0da5259a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadataget.go @@ -0,0 +1,53 @@ +package vminstancehybrididentitymetadata + +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 VirtualMachineInstanceHybridIdentityMetadataGetOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *VMInstanceHybridIdentityMetadata +} + +// VirtualMachineInstanceHybridIdentityMetadataGet ... +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataGet(ctx context.Context, id commonids.ScopeId) (result VirtualMachineInstanceHybridIdentityMetadataGetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata/default", id.ID()), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go new file mode 100644 index 000000000000..e47f31db7a8b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/method_virtualmachineinstancehybrididentitymetadatalist.go @@ -0,0 +1,90 @@ +package vminstancehybrididentitymetadata + +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 VirtualMachineInstanceHybridIdentityMetadataListOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]VMInstanceHybridIdentityMetadata +} + +type VirtualMachineInstanceHybridIdentityMetadataListCompleteResult struct { + Items []VMInstanceHybridIdentityMetadata +} + +// VirtualMachineInstanceHybridIdentityMetadataList ... +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataList(ctx context.Context, id commonids.ScopeId) (result VirtualMachineInstanceHybridIdentityMetadataListOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/virtualMachineInstances/default/hybridIdentityMetadata", 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 *[]VMInstanceHybridIdentityMetadata `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// VirtualMachineInstanceHybridIdentityMetadataListComplete retrieves all the results into a single object +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataListComplete(ctx context.Context, id commonids.ScopeId) (VirtualMachineInstanceHybridIdentityMetadataListCompleteResult, error) { + return c.VirtualMachineInstanceHybridIdentityMetadataListCompleteMatchingPredicate(ctx, id, VMInstanceHybridIdentityMetadataOperationPredicate{}) +} + +// VirtualMachineInstanceHybridIdentityMetadataListCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMInstanceHybridIdentityMetadataClient) VirtualMachineInstanceHybridIdentityMetadataListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate VMInstanceHybridIdentityMetadataOperationPredicate) (result VirtualMachineInstanceHybridIdentityMetadataListCompleteResult, err error) { + items := make([]VMInstanceHybridIdentityMetadata, 0) + + resp, err := c.VirtualMachineInstanceHybridIdentityMetadataList(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = VirtualMachineInstanceHybridIdentityMetadataListCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go new file mode 100644 index 000000000000..c84683e12195 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadata.go @@ -0,0 +1,16 @@ +package vminstancehybrididentitymetadata + +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 VMInstanceHybridIdentityMetadata struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties VMInstanceHybridIdentityMetadataProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go new file mode 100644 index 000000000000..67e5598fff71 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/model_vminstancehybrididentitymetadataproperties.go @@ -0,0 +1,10 @@ +package vminstancehybrididentitymetadata + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMInstanceHybridIdentityMetadataProperties struct { + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + PublicKey *string `json:"publicKey,omitempty"` + ResourceUid *string `json:"resourceUid,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go new file mode 100644 index 000000000000..2b14e1e41ff7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/predicates.go @@ -0,0 +1,27 @@ +package vminstancehybrididentitymetadata + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMInstanceHybridIdentityMetadataOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p VMInstanceHybridIdentityMetadataOperationPredicate) Matches(input VMInstanceHybridIdentityMetadata) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go new file mode 100644 index 000000000000..e7b052b612a6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata/version.go @@ -0,0 +1,12 @@ +package vminstancehybrididentitymetadata + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vminstancehybrididentitymetadata/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md new file mode 100644 index 000000000000..3a6a1c40d820 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/README.md @@ -0,0 +1,116 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers` Documentation + +The `vmmservers` SDK allows for interaction with the Azure Resource Manager Service `systemcentervirtualmachinemanager` (API Version `2023-10-07`). + +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/systemcentervirtualmachinemanager/2023-10-07/vmmservers" +``` + + +### Client Initialization + +```go +client := vmmservers.NewVMmServersClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `VMmServersClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +payload := vmmservers.VMMServer{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `VMmServersClient.Delete` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +if err := client.DeleteThenPoll(ctx, id, vmmservers.DefaultDeleteOperationOptions()); err != nil { + // handle the error +} +``` + + +### Example Usage: `VMmServersClient.Get` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +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: `VMmServersClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := vmmservers.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: `VMmServersClient.ListBySubscription` + +```go +ctx := context.TODO() +id := vmmservers.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: `VMmServersClient.Update` + +```go +ctx := context.TODO() +id := vmmservers.NewVMmServerID("12345678-1234-9876-4563-123456789012", "example-resource-group", "vmmServerValue") + +payload := vmmservers.ResourcePatch{ + // ... +} + + +if err := client.UpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go new file mode 100644 index 000000000000..ff1fc1061d59 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/client.go @@ -0,0 +1,26 @@ +package vmmservers + +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 VMmServersClient struct { + Client *resourcemanager.Client +} + +func NewVMmServersClientWithBaseURI(sdkApi sdkEnv.Api) (*VMmServersClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "vmmservers", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating VMmServersClient: %+v", err) + } + + return &VMmServersClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go new file mode 100644 index 000000000000..6eeaba57dab0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/constants.go @@ -0,0 +1,110 @@ +package vmmservers + +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 Force string + +const ( + ForceFalse Force = "false" + ForceTrue Force = "true" +) + +func PossibleValuesForForce() []string { + return []string{ + string(ForceFalse), + string(ForceTrue), + } +} + +func (s *Force) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseForce(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseForce(input string) (*Force, error) { + vals := map[string]Force{ + "false": ForceFalse, + "true": ForceTrue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := Force(input) + return &out, nil +} + +type ProvisioningState string + +const ( + ProvisioningStateAccepted ProvisioningState = "Accepted" + ProvisioningStateCanceled ProvisioningState = "Canceled" + ProvisioningStateCreated ProvisioningState = "Created" + ProvisioningStateDeleting ProvisioningState = "Deleting" + ProvisioningStateFailed ProvisioningState = "Failed" + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +func PossibleValuesForProvisioningState() []string { + return []string{ + string(ProvisioningStateAccepted), + string(ProvisioningStateCanceled), + string(ProvisioningStateCreated), + string(ProvisioningStateDeleting), + string(ProvisioningStateFailed), + string(ProvisioningStateProvisioning), + string(ProvisioningStateSucceeded), + string(ProvisioningStateUpdating), + } +} + +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, + "created": ProvisioningStateCreated, + "deleting": ProvisioningStateDeleting, + "failed": ProvisioningStateFailed, + "provisioning": ProvisioningStateProvisioning, + "succeeded": ProvisioningStateSucceeded, + "updating": ProvisioningStateUpdating, + } + 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 +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go new file mode 100644 index 000000000000..962171b7d305 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go @@ -0,0 +1,127 @@ +package vmmservers + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = VMmServerId{} + +// VMmServerId is a struct representing the Resource ID for a V Mm Server +type VMmServerId struct { + SubscriptionId string + ResourceGroupName string + VmmServerName string +} + +// NewVMmServerID returns a new VMmServerId struct +func NewVMmServerID(subscriptionId string, resourceGroupName string, vmmServerName string) VMmServerId { + return VMmServerId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + VmmServerName: vmmServerName, + } +} + +// ParseVMmServerID parses 'input' into a VMmServerId +func ParseVMmServerID(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(VMmServerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMmServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + } + + return &id, nil +} + +// ParseVMmServerIDInsensitively parses 'input' case-insensitively into a VMmServerId +// note: this method should only be used for API response data and not user input +func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { + parser := resourceids.NewParserFromResourceIdType(VMmServerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := VMmServerId{} + + if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + } + + if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + } + + if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { + return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + } + + return &id, nil +} + +// ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID +func ValidateVMmServerID(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 := ParseVMmServerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted V Mm Server ID +func (id VMmServerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ScVmm/vmmServers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.VmmServerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this V Mm Server ID +func (id VMmServerId) 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("staticMicrosoftScVmm", "Microsoft.ScVmm", "Microsoft.ScVmm"), + resourceids.StaticSegment("staticVmmServers", "vmmServers", "vmmServers"), + resourceids.UserSpecifiedSegment("vmmServerName", "vmmServerValue"), + } +} + +// String returns a human-readable description of this V Mm Server ID +func (id VMmServerId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Vmm Server Name: %q", id.VmmServerName), + } + return fmt.Sprintf("V Mm Server (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go new file mode 100644 index 000000000000..df8dcc4b8929 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_createorupdate.go @@ -0,0 +1,74 @@ +package vmmservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c VMmServersClient) CreateOrUpdate(ctx context.Context, id VMmServerId, input VMMServer) (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 VMmServersClient) CreateOrUpdateThenPoll(ctx context.Context, id VMmServerId, input VMMServer) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go new file mode 100644 index 000000000000..b68e32b8439b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_delete.go @@ -0,0 +1,98 @@ +package vmmservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/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 { + Force *Force +} + +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.Force != nil { + out.Append("force", fmt.Sprintf("%v", *o.Force)) + } + return &out +} + +// Delete ... +func (c VMmServersClient) Delete(ctx context.Context, id VMmServerId, options DeleteOperationOptions) (result DeleteOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusAccepted, + http.StatusNoContent, + }, + HttpMethod: http.MethodDelete, + Path: id.ID(), + OptionsObject: options, + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + result.Poller, err = resourcemanager.PollerFromResponse(resp, c.Client) + if err != nil { + return + } + + return +} + +// DeleteThenPoll performs Delete then polls until it's completed +func (c VMmServersClient) DeleteThenPoll(ctx context.Context, id VMmServerId, 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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go new file mode 100644 index 000000000000..a3a67be4c9f2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_get.go @@ -0,0 +1,51 @@ +package vmmservers + +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 *VMMServer +} + +// Get ... +func (c VMmServersClient) Get(ctx context.Context, id VMmServerId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go new file mode 100644 index 000000000000..75e4a74c0a62 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package vmmservers + +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 *[]VMMServer +} + +type ListByResourceGroupCompleteResult struct { + Items []VMMServer +} + +// ListByResourceGroup ... +func (c VMmServersClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/vmmServers", 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 *[]VMMServer `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 VMmServersClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, VMMServerOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMmServersClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate VMMServerOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]VMMServer, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go new file mode 100644 index 000000000000..109aab801a0e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_listbysubscription.go @@ -0,0 +1,90 @@ +package vmmservers + +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 *[]VMMServer +} + +type ListBySubscriptionCompleteResult struct { + Items []VMMServer +} + +// ListBySubscription ... +func (c VMmServersClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ScVmm/vmmServers", 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 *[]VMMServer `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 VMmServersClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, VMMServerOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c VMmServersClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate VMMServerOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]VMMServer, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go new file mode 100644 index 000000000000..9d6098e8bdd0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/method_update.go @@ -0,0 +1,74 @@ +package vmmservers + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type UpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// Update ... +func (c VMmServersClient) Update(ctx context.Context, id VMmServerId, input ResourcePatch) (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 VMmServersClient) UpdateThenPoll(ctx context.Context, id VMmServerId, input ResourcePatch) error { + result, err := c.Update(ctx, id, input) + if err != nil { + return fmt.Errorf("performing Update: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Update: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go new file mode 100644 index 000000000000..ef8c8a113bce --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_extendedlocation.go @@ -0,0 +1,9 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ExtendedLocation struct { + Name *string `json:"name,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go new file mode 100644 index 000000000000..b5b742ed7b12 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_resourcepatch.go @@ -0,0 +1,8 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ResourcePatch struct { + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go new file mode 100644 index 000000000000..139ef67e0e2f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmcredential.go @@ -0,0 +1,9 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMMCredential struct { + Password *string `json:"password,omitempty"` + Username *string `json:"username,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go new file mode 100644 index 000000000000..bb0e9a9b3394 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserver.go @@ -0,0 +1,19 @@ +package vmmservers + +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 VMMServer struct { + ExtendedLocation ExtendedLocation `json:"extendedLocation"` + Id *string `json:"id,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties VMMServerProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go new file mode 100644 index 000000000000..6532dae951fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/model_vmmserverproperties.go @@ -0,0 +1,15 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMMServerProperties struct { + ConnectionStatus *string `json:"connectionStatus,omitempty"` + Credentials *VMMCredential `json:"credentials,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Fqdn string `json:"fqdn"` + Port *int64 `json:"port,omitempty"` + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty"` + Uuid *string `json:"uuid,omitempty"` + Version *string `json:"version,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go new file mode 100644 index 000000000000..c2a867ae8f50 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/predicates.go @@ -0,0 +1,32 @@ +package vmmservers + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VMMServerOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p VMMServerOperationPredicate) Matches(input VMMServer) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Location != nil && *p.Location != input.Location { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go new file mode 100644 index 000000000000..42b3cbefc9f9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/version.go @@ -0,0 +1,12 @@ +package vmmservers + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2023-10-07" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/vmmservers/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index baef6054afe5..5ad19ed2ef9b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -960,6 +960,16 @@ github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/st github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2020-03-01/transformations github.com/hashicorp/go-azure-sdk/resource-manager/streamanalytics/2021-10-01-preview/outputs github.com/hashicorp/go-azure-sdk/resource-manager/subscription/2021-10-01/subscriptions +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07 +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachineinstances +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstanceguestagents +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vminstancehybrididentitymetadata +github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15 github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15/accesspolicies github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15/environments diff --git a/website/allowed-subcategories b/website/allowed-subcategories index 89cd7a82e828..450fe278c521 100644 --- a/website/allowed-subcategories +++ b/website/allowed-subcategories @@ -101,6 +101,7 @@ Storage Storage Mover Stream Analytics Synapse +System Center Virtual Machine Manager Template Time Series Insights VMware (AVS) diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown new file mode 100644 index 000000000000..0bb2a4d90364 --- /dev/null +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -0,0 +1,85 @@ +--- +subcategory: "System Center Virtual Machine Manager" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_system_center_virtual_machine_manager_server" +description: |- + Manages a System Center Virtual Machine Manager Server. +--- + +# azurerm_system_center_virtual_machine_manager_server + +Manages a System Center Virtual Machine Manager Server. + +~> **Note:** By request of the service team the provider no longer automatically registering the `Microsoft.ScVmm` Resource Provider for this resource. To register it you can run `az provider register --namespace Microsoft.ScVmm`. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +data "azurerm_extended_locations" "example" { + location = azurerm_resource_group.example.location +} + +resource "azurerm_system_center_virtual_machine_manager_server" "example" { + name = "example-scvmmms" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location + edge_zone = data.azurerm_extended_locations.example.extended_locations[0] + fqdn = "exampledomain.com" +} +``` + +## Arguments Reference + +The following arguments are supported: + +* `name` - (Required) The name which should be used for this System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. + +* `resource_group_name` - (Required) The name of the Resource Group where the System Center Virtual Machine Manager should exist. Changing this forces a new resource to be created. + +* `location` - (Required) The Azure Region where the System Center Virtual Machine Manager Server should exist. Changing this forces a new resource to be created. + +* `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Server. + +* `fqdn` - (Required) The FQDN of the System Center Virtual Machine Manager Server. + +* `credential` - (Optional) A `credential` block as defined below. + +* `port` - (Optional) The port that is used to listened by the System Center Virtual Machine Manager Server. Possible values are between `1` and `65535`. + +* `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Server. + +--- + +A `credential` block supports the following: + +* `username` - (Optional) The username that is used to connect to the System Center Virtual Machine Manager Server. + +* `password` - (Optional) The password that is used to connect to the System Center Virtual Machine Manager Server. + +## Attributes Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the System Center Virtual Machine Manager Server. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating this System Center Virtual Machine Manager Server. +* `read` - (Defaults to 5 minutes) Used when retrieving this System Center Virtual Machine Manager Server. +* `update` - (Defaults to 30 minutes) Used when updating this System Center Virtual Machine Manager Server. +* `delete` - (Defaults to 30 minutes) Used when deleting this System Center Virtual Machine Manager Server. + +## Import + +System Center Virtual Machine Manager Servers can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_system_center_virtual_machine_manager_server.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceGroup1/providers/Microsoft.ScVmm/vmmServers/vmmServer1 +``` From 2a1483aa56f7e10e32874014114b21e6f0ab2c87 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Thu, 14 Dec 2023 16:50:07 +0800 Subject: [PATCH 02/17] update code --- .../parse/custom_location.go | 72 +++++++++++ .../parse/custom_location_test.go | 115 ++++++++++++++++++ .../resourceids.go | 3 + ...virtual_machine_manager_server_resource.go | 47 +++---- ...al_machine_manager_server_resource_test.go | 86 ++++++++----- .../validate/custom_location_id.go | 26 ++++ .../validate/custom_location_id_test.go | 79 ++++++++++++ ...rtual_machine_manager_server.html.markdown | 16 +-- 8 files changed, 381 insertions(+), 63 deletions(-) create mode 100644 internal/services/systemcentervirtualmachinemanager/parse/custom_location.go create mode 100644 internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go create mode 100644 internal/services/systemcentervirtualmachinemanager/resourceids.go create mode 100644 internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go create mode 100644 internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go diff --git a/internal/services/systemcentervirtualmachinemanager/parse/custom_location.go b/internal/services/systemcentervirtualmachinemanager/parse/custom_location.go new file mode 100644 index 000000000000..942d1d3098ea --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/parse/custom_location.go @@ -0,0 +1,72 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type CustomLocationId struct { + SubscriptionId string + ResourceGroup string + Name string +} + +func NewCustomLocationID(subscriptionId, resourceGroup, name string) CustomLocationId { + return CustomLocationId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + Name: name, + } +} + +func (id CustomLocationId) String() string { + segments := []string{ + fmt.Sprintf("Name %q", id.Name), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Custom Location", segmentsStr) +} + +func (id CustomLocationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ExtendedLocation/customLocations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) +} + +// CustomLocationID parses a CustomLocation ID into an CustomLocationId struct +func CustomLocationID(input string) (*CustomLocationId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("parsing %q as an CustomLocation ID: %+v", input, err) + } + + resourceId := CustomLocationId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.Name, err = id.PopSegment("customLocations"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go b/internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go new file mode 100644 index 000000000000..29b50e997d4b --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go @@ -0,0 +1,115 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = CustomLocationId{} + +func TestCustomLocationIDFormatter(t *testing.T) { + actual := NewCustomLocationID("12345678-1234-9876-4563-123456789012", "resGroup1", "customLocation1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestCustomLocationID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *CustomLocationId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/", + Error: true, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1", + Expected: &CustomLocationId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "customLocation1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.EXTENDEDLOCATION/CUSTOMLOCATIONS/CUSTOMLOCATION1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := CustomLocationID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.Name != v.Expected.Name { + t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) + } + } +} diff --git a/internal/services/systemcentervirtualmachinemanager/resourceids.go b/internal/services/systemcentervirtualmachinemanager/resourceids.go new file mode 100644 index 000000000000..a0fa7a3f52fa --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/resourceids.go @@ -0,0 +1,3 @@ +package systemcentervirtualmachinemanager + +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CustomLocation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1 diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go index d3d48eef6aa7..901161c29707 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -63,37 +63,40 @@ func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string] "location": commonschema.Location(), - "custom_location_id": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "fqdn": { - Type: pluginsdk.TypeString, - Required: true, - }, - "credential": { Type: pluginsdk.TypeList, - Optional: true, + Required: true, MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ "username": { - Type: pluginsdk.TypeString, - Optional: true, + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, }, "password": { - Type: pluginsdk.TypeString, - Optional: true, - Sensitive: true, + Type: pluginsdk.TypeString, + Required: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, }, }, }, }, + "custom_location_id": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validate.CustomLocationID, + }, + + "fqdn": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + "port": { Type: pluginsdk.TypeInt, Optional: true, @@ -145,8 +148,8 @@ func (r SystemCenterVirtualMachineManagerServerResource) Create() sdk.ResourceFu Tags: pointer.To(model.Tags), } - if model.Port != 0 { - parameters.Properties.Port = utils.Int64(int64(model.Port)) + if v := model.Port; v != 0 { + parameters.Properties.Port = utils.Int64(int64(v)) } if err := client.CreateOrUpdateThenPoll(ctx, id, *parameters); err != nil { @@ -185,7 +188,7 @@ func (r SystemCenterVirtualMachineManagerServerResource) Read() sdk.ResourceFunc state.Location = location.Normalize(model.Location) state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) state.Fqdn = model.Properties.Fqdn - state.Credential = flattenSystemCenterVirtualMachineManagerServerCredential(model.Properties.Credentials) + state.Credential = flattenSystemCenterVirtualMachineManagerServerCredential(model.Properties.Credentials, metadata.ResourceData.Get("credential.0.password").(string)) state.Tags = pointer.From(model.Tags) if v := model.Properties.Port; v != nil { @@ -291,7 +294,7 @@ func expandSystemCenterVirtualMachineManagerServerCredential(input []Credential) return result } -func flattenSystemCenterVirtualMachineManagerServerCredential(input *vmmservers.VMMCredential) []Credential { +func flattenSystemCenterVirtualMachineManagerServerCredential(input *vmmservers.VMMCredential, password string) []Credential { result := make([]Credential, 0) if input == nil { return result @@ -299,7 +302,7 @@ func flattenSystemCenterVirtualMachineManagerServerCredential(input *vmmservers. credential := Credential{ Username: pointer.From(input.Username), - Password: pointer.From(input.Password), + Password: password, } return append(result, credential) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go index 49a0cd2472a1..97d402c4b00d 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -3,6 +3,7 @@ package systemcentervirtualmachinemanager_test import ( "context" "fmt" + "os" "testing" "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" @@ -15,26 +16,43 @@ import ( type SystemCenterVirtualMachineManagerServerResource struct{} -func TestAccSystemCenterVirtualMachineManagerServer_basic(t *testing.T) { +func TestAccSystemCenterVirtualMachineManagerServerSequential(t *testing.T) { + // NOTE: this is a combined test rather than separate split out tests because only one System Center Virtual Machine Manager Server can be onboarded at a time on a given Custom Location + + if os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID") == "" || os.Getenv("ARM_TEST_FQDN") == "" || os.Getenv("ARM_TEST_USERNAME") == "" || os.Getenv("ARM_TEST_PASSWORD") == "" { + t.Skip("Skipping as one of `ARM_TEST_CUSTOM_LOCATION_ID`, `ARM_TEST_FQDN`, `ARM_TEST_USERNAME`, `ARM_TEST_PASSWORD` was not specified") + } + + acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ + "scvmmServer": { + "basic": testAccSystemCenterVirtualMachineManagerServer_basic, + "requiresImport": testAccSystemCenterVirtualMachineManagerServer_requiresImport, + "complete": testAccSystemCenterVirtualMachineManagerServer_complete, + "update": testAccSystemCenterVirtualMachineManagerServer_update, + }, + }) +} + +func testAccSystemCenterVirtualMachineManagerServer_basic(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") r := SystemCenterVirtualMachineManagerServerResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("credential.0.password"), }) } -func TestAccSystemCenterVirtualMachineManagerServer_requiresImport(t *testing.T) { +func testAccSystemCenterVirtualMachineManagerServer_requiresImport(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") r := SystemCenterVirtualMachineManagerServerResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.basic(data), Check: acceptance.ComposeTestCheckFunc( @@ -45,40 +63,40 @@ func TestAccSystemCenterVirtualMachineManagerServer_requiresImport(t *testing.T) }) } -func TestAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { +func testAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") r := SystemCenterVirtualMachineManagerServerResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("credential.0.password"), }) } -func TestAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { +func testAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { data := acceptance.BuildTestData(t, "azurerm_system_center_virtual_machine_manager_server", "test") r := SystemCenterVirtualMachineManagerServerResource{} - data.ResourceTest(t, r, []acceptance.TestStep{ + data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("credential.0.password"), { Config: r.update(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep(), + data.ImportStep("credential.0.password"), }) } @@ -104,10 +122,15 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { name = "acctest-scvmmms-%d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location - custom_location_id = azurerm_custom_location.test.id - fqdn = "testdomain.com" + custom_location_id = "%s" + fqdn = "%s" + + credential { + username = "%s" + password = "%s" + } } -`, r.template(data), data.RandomInteger) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } func (r SystemCenterVirtualMachineManagerServerResource) requiresImport(data acceptance.TestData) string { @@ -120,8 +143,13 @@ resource "azurerm_system_center_virtual_machine_manager_server" "import" { location = azurerm_system_center_virtual_machine_manager_server.test.location custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id fqdn = azurerm_system_center_virtual_machine_manager_server.test.fqdn + + credential { + username = "%s" + password = "%s" + } } -`, r.basic(data)) +`, r.basic(data), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData) string { @@ -132,20 +160,20 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { name = "acctest-scvmmms-%d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location - custom_location_id = azurerm_custom_location.test.id - fqdn = "testdomain.com" + custom_location_id = "%s" + fqdn = "%s" port = 10000 credential { - username = "adminTerraform" - password = "QAZwsx123" + username = "%s" + password = "%s" } tags = { Env = "Test" } } -`, r.template(data), data.RandomInteger) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } func (r SystemCenterVirtualMachineManagerServerResource) update(data acceptance.TestData) string { @@ -156,20 +184,20 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { name = "acctest-scvmmms-%d" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location - custom_location_id = azurerm_custom_location.test.id - fqdn = "testdomain2.com" + custom_location_id = "%s" + fqdn = "%s" port = 10001 credential { - username = "adminTerraform2" - password = "QAZwsx124" + username = "%s" + password = "%s" } tags = { Env = "Test2" } } -`, r.template(data), data.RandomInteger) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { @@ -182,9 +210,5 @@ resource "azurerm_resource_group" "test" { name = "acctestrg-scvmmms-%d" location = "%s" } - -resource "azurerm_custom_location" "test" { - name = "acctest-cl-%d" -} -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +`, data.RandomInteger, data.Locations.Primary) } diff --git a/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go b/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go new file mode 100644 index 000000000000..3a9c4d483365 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go @@ -0,0 +1,26 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/parse" +) + +func CustomLocationID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.CustomLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go b/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go new file mode 100644 index 000000000000..51c0ca895f51 --- /dev/null +++ b/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go @@ -0,0 +1,79 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestCustomLocationID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/", + Valid: false, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.EXTENDEDLOCATION/CUSTOMLOCATIONS/CUSTOMLOCATION1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := CustomLocationID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown index 0bb2a4d90364..3357bab936b5 100644 --- a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -20,16 +20,12 @@ resource "azurerm_resource_group" "example" { location = "West Europe" } -data "azurerm_extended_locations" "example" { - location = azurerm_resource_group.example.location -} - resource "azurerm_system_center_virtual_machine_manager_server" "example" { name = "example-scvmmms" resource_group_name = azurerm_resource_group.example.name location = azurerm_resource_group.example.location - edge_zone = data.azurerm_extended_locations.example.extended_locations[0] - fqdn = "exampledomain.com" + custom_location_id = "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1" + fqdn = "example.labtest" } ``` @@ -43,12 +39,12 @@ The following arguments are supported: * `location` - (Required) The Azure Region where the System Center Virtual Machine Manager Server should exist. Changing this forces a new resource to be created. +* `credential` - (Required) A `credential` block as defined below. + * `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Server. * `fqdn` - (Required) The FQDN of the System Center Virtual Machine Manager Server. -* `credential` - (Optional) A `credential` block as defined below. - * `port` - (Optional) The port that is used to listened by the System Center Virtual Machine Manager Server. Possible values are between `1` and `65535`. * `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Server. @@ -57,9 +53,9 @@ The following arguments are supported: A `credential` block supports the following: -* `username` - (Optional) The username that is used to connect to the System Center Virtual Machine Manager Server. +* `username` - (Required) The username that is used to connect to the System Center Virtual Machine Manager Server. -* `password` - (Optional) The password that is used to connect to the System Center Virtual Machine Manager Server. +* `password` - (Required) The password that is used to connect to the System Center Virtual Machine Manager Server. ## Attributes Reference From 434be7adc28b583bd51996740db3c091707e5491 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Fri, 15 Dec 2023 13:17:37 +0800 Subject: [PATCH 03/17] update code --- ...center_virtual_machine_manager_server_resource.go | 5 +---- ...r_virtual_machine_manager_server_resource_test.go | 12 ++++++------ 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go index 901161c29707..9a47cd8eeadf 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -226,6 +226,7 @@ func (r SystemCenterVirtualMachineManagerServerResource) Update() sdk.ResourceFu if parameters == nil { return fmt.Errorf("retrieving %s: model was nil", *id) } + parameters.Properties.Credentials = expandSystemCenterVirtualMachineManagerServerCredential(model.Credential) if metadata.ResourceData.HasChange("custom_location_id") { parameters.ExtendedLocation = vmmservers.ExtendedLocation{ @@ -242,10 +243,6 @@ func (r SystemCenterVirtualMachineManagerServerResource) Update() sdk.ResourceFu parameters.Properties.Port = utils.Int64(int64(model.Port)) } - if metadata.ResourceData.HasChange("credential") { - parameters.Properties.Credentials = expandSystemCenterVirtualMachineManagerServerCredential(model.Credential) - } - if metadata.ResourceData.HasChange("tags") { parameters.Tags = pointer.To(model.Tags) } diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go index 97d402c4b00d..3d7d862b659f 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -19,8 +19,8 @@ type SystemCenterVirtualMachineManagerServerResource struct{} func TestAccSystemCenterVirtualMachineManagerServerSequential(t *testing.T) { // NOTE: this is a combined test rather than separate split out tests because only one System Center Virtual Machine Manager Server can be onboarded at a time on a given Custom Location - if os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID") == "" || os.Getenv("ARM_TEST_FQDN") == "" || os.Getenv("ARM_TEST_USERNAME") == "" || os.Getenv("ARM_TEST_PASSWORD") == "" { - t.Skip("Skipping as one of `ARM_TEST_CUSTOM_LOCATION_ID`, `ARM_TEST_FQDN`, `ARM_TEST_USERNAME`, `ARM_TEST_PASSWORD` was not specified") + if os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID") == "" || os.Getenv("ARM_TEST_FQDN") == "" || os.Getenv("ARM_TEST_PORT") == "" || os.Getenv("ARM_TEST_USERNAME") == "" || os.Getenv("ARM_TEST_PASSWORD") == "" { + t.Skip("Skipping as one of `ARM_TEST_CUSTOM_LOCATION_ID`, `ARM_TEST_FQDN`, `ARM_TEST_PORT`, `ARM_TEST_USERNAME`, `ARM_TEST_PASSWORD` was not specified") } acceptance.RunTestsInSequence(t, map[string]map[string]func(t *testing.T){ @@ -162,7 +162,7 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { location = azurerm_resource_group.test.location custom_location_id = "%s" fqdn = "%s" - port = 10000 + port = tonumber("%s") credential { username = "%s" @@ -173,7 +173,7 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { Env = "Test" } } -`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } func (r SystemCenterVirtualMachineManagerServerResource) update(data acceptance.TestData) string { @@ -186,7 +186,7 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { location = azurerm_resource_group.test.location custom_location_id = "%s" fqdn = "%s" - port = 10001 + port = tonumber("%s") credential { username = "%s" @@ -197,7 +197,7 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { Env = "Test2" } } -`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { From c4d2557c7b3f0488b4da24adfcb86837fb6c1f95 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Fri, 15 Dec 2023 15:24:58 +0800 Subject: [PATCH 04/17] update code --- ...virtual_machine_manager_server_resource.go | 37 ++++--------------- ...al_machine_manager_server_resource_test.go | 36 +++--------------- ...rtual_machine_manager_server.html.markdown | 10 ++--- 3 files changed, 19 insertions(+), 64 deletions(-) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go index 9a47cd8eeadf..4e7c7a497b6e 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -72,12 +72,14 @@ func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string] "username": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, "password": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, @@ -88,18 +90,21 @@ func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string] "custom_location_id": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, ValidateFunc: validate.CustomLocationID, }, "fqdn": { Type: pluginsdk.TypeString, Required: true, + ForceNew: true, ValidateFunc: validation.StringIsNotEmpty, }, "port": { Type: pluginsdk.TypeInt, Optional: true, + ForceNew: true, ValidateFunc: validation.IntBetween(1, 65535), }, @@ -217,37 +222,11 @@ func (r SystemCenterVirtualMachineManagerServerResource) Update() sdk.ResourceFu return fmt.Errorf("decoding: %+v", err) } - existing, err := client.Get(ctx, *id) - if err != nil { - return fmt.Errorf("retrieving %s: %+v", *id, err) - } - - parameters := existing.Model - if parameters == nil { - return fmt.Errorf("retrieving %s: model was nil", *id) - } - parameters.Properties.Credentials = expandSystemCenterVirtualMachineManagerServerCredential(model.Credential) - - if metadata.ResourceData.HasChange("custom_location_id") { - parameters.ExtendedLocation = vmmservers.ExtendedLocation{ - Type: utils.String("customLocation"), - Name: utils.String(model.CustomLocationId), - } - } - - if metadata.ResourceData.HasChange("fqdn") { - parameters.Properties.Fqdn = model.Fqdn - } - - if metadata.ResourceData.HasChange("port") { - parameters.Properties.Port = utils.Int64(int64(model.Port)) - } - - if metadata.ResourceData.HasChange("tags") { - parameters.Tags = pointer.To(model.Tags) + parameters := vmmservers.ResourcePatch{ + Tags: pointer.To(model.Tags), } - if err := client.CreateOrUpdateThenPoll(ctx, *id, *parameters); err != nil { + if err := client.UpdateThenPoll(ctx, *id, parameters); err != nil { return fmt.Errorf("updating %s: %+v", *id, err) } diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go index 3d7d862b659f..6b8c2aa5284e 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -69,7 +69,7 @@ func testAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { - Config: r.complete(data), + Config: r.complete(data, "Test"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -84,14 +84,14 @@ func testAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { - Config: r.complete(data), + Config: r.complete(data, "Test"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("credential.0.password"), { - Config: r.update(data), + Config: r.complete(data, "Test2"), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -152,7 +152,7 @@ resource "azurerm_system_center_virtual_machine_manager_server" "import" { `, r.basic(data), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } -func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData) string { +func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData, tag string) string { return fmt.Sprintf(` %s @@ -170,34 +170,10 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { } tags = { - Env = "Test" + Env = "%s" } } -`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) -} - -func (r SystemCenterVirtualMachineManagerServerResource) update(data acceptance.TestData) string { - return fmt.Sprintf(` -%s - -resource "azurerm_system_center_virtual_machine_manager_server" "test" { - name = "acctest-scvmmms-%d" - resource_group_name = azurerm_resource_group.test.name - location = azurerm_resource_group.test.location - custom_location_id = "%s" - fqdn = "%s" - port = tonumber("%s") - - credential { - username = "%s" - password = "%s" - } - - tags = { - Env = "Test2" - } -} -`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD"), tag) } func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown index 3357bab936b5..1f2dc977c359 100644 --- a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -41,11 +41,11 @@ The following arguments are supported: * `credential` - (Required) A `credential` block as defined below. -* `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Server. +* `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. -* `fqdn` - (Required) The FQDN of the System Center Virtual Machine Manager Server. +* `fqdn` - (Required) The FQDN of the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. -* `port` - (Optional) The port that is used to listened by the System Center Virtual Machine Manager Server. Possible values are between `1` and `65535`. +* `port` - (Optional) The port that is used to listened by the System Center Virtual Machine Manager Server. Possible values are between `1` and `65535`. Changing this forces a new resource to be created. * `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Server. @@ -53,9 +53,9 @@ The following arguments are supported: A `credential` block supports the following: -* `username` - (Required) The username that is used to connect to the System Center Virtual Machine Manager Server. +* `username` - (Required) The username that is used to connect to the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. -* `password` - (Required) The password that is used to connect to the System Center Virtual Machine Manager Server. +* `password` - (Required) The password that is used to connect to the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. ## Attributes Reference From a39c5ece94f62f58b95b085d9ba5d8f95fa4006d Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Mon, 18 Dec 2023 11:00:54 +0800 Subject: [PATCH 05/17] update code --- .../availabilitysets/id_availabilityset.go | 38 ++++++++------- .../2023-10-07/clouds/id_cloud.go | 38 ++++++++------- .../inventoryitems/id_inventoryitem.go | 46 ++++++++----------- .../2023-10-07/inventoryitems/id_vmmserver.go | 38 ++++++++------- .../id_virtualmachinetemplate.go | 38 ++++++++------- .../virtualnetworks/id_virtualnetwork.go | 38 ++++++++------- .../2023-10-07/vmmservers/id_vmmserver.go | 38 ++++++++------- 7 files changed, 128 insertions(+), 146 deletions(-) diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go index ae57f4330c97..16cdd02f8616 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/availabilitysets/id_availabilityset.go @@ -36,19 +36,9 @@ func ParseAvailabilitySetID(input string) (*AvailabilitySetId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseAvailabilitySetIDInsensitively(input string) (*AvailabilitySetId, erro return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := AvailabilitySetId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *AvailabilitySetId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.AvailabilitySetName, ok = parsed.Parsed["availabilitySetName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", *parsed) + if id.AvailabilitySetName, ok = input.Parsed["availabilitySetName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "availabilitySetName", input) } - return &id, nil + return nil } // ValidateAvailabilitySetID checks that 'input' can be parsed as a Availability Set ID diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go index 57d2b09f4552..c3b5cd0d97ea 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/clouds/id_cloud.go @@ -36,19 +36,9 @@ func ParseCloudID(input string) (*CloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.CloudName, ok = parsed.Parsed["cloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseCloudIDInsensitively(input string) (*CloudId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := CloudId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *CloudId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.CloudName, ok = parsed.Parsed["cloudName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "cloudName", *parsed) + if id.CloudName, ok = input.Parsed["cloudName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "cloudName", input) } - return &id, nil + return nil } // ValidateCloudID checks that 'input' can be parsed as a Cloud ID diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go index 1814b6aabd07..b81296c55a1c 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_inventoryitem.go @@ -38,23 +38,9 @@ func ParseInventoryItemID(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) - } - - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -69,26 +55,34 @@ func ParseInventoryItemIDInsensitively(input string) (*InventoryItemId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := InventoryItemId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *InventoryItemId) FromParseResult(input resourceids.ParseResult) error { + var ok bool - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) + if id.SubscriptionId, ok = input.Parsed["subscriptionId"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", input) } - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if id.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) } - if id.InventoryItemName, ok = parsed.Parsed["inventoryItemName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", *parsed) + if id.InventoryItemName, ok = input.Parsed["inventoryItemName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "inventoryItemName", input) } - return &id, nil + return nil } // ValidateInventoryItemID checks that 'input' can be parsed as a Inventory Item ID diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go index 22a411b74225..46ecadb2cf79 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/inventoryitems/id_vmmserver.go @@ -36,19 +36,9 @@ func ParseVMmServerID(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMmServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if id.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) } - return &id, nil + return nil } // ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go index 5b723986aad5..0d04f23ff6e1 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualmachinetemplates/id_virtualmachinetemplate.go @@ -36,19 +36,9 @@ func ParseVirtualMachineTemplateID(input string) (*VirtualMachineTemplateId, err return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualMachineTemplateIDInsensitively(input string) (*VirtualMachineTe return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualMachineTemplateId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualMachineTemplateId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualMachineTemplateName, ok = parsed.Parsed["virtualMachineTemplateName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", *parsed) + if id.VirtualMachineTemplateName, ok = input.Parsed["virtualMachineTemplateName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualMachineTemplateName", input) } - return &id, nil + return nil } // ValidateVirtualMachineTemplateID checks that 'input' can be parsed as a Virtual Machine Template ID diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go index 2b3547af7032..0fdd39e3909f 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/virtualnetworks/id_virtualnetwork.go @@ -36,19 +36,9 @@ func ParseVirtualNetworkID(input string) (*VirtualNetworkId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVirtualNetworkIDInsensitively(input string) (*VirtualNetworkId, error) return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VirtualNetworkId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VirtualNetworkId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VirtualNetworkName, ok = parsed.Parsed["virtualNetworkName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", *parsed) + if id.VirtualNetworkName, ok = input.Parsed["virtualNetworkName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "virtualNetworkName", input) } - return &id, nil + return nil } // ValidateVirtualNetworkID checks that 'input' can be parsed as a Virtual Network ID diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go index 962171b7d305..5bc06809f151 100644 --- a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers/id_vmmserver.go @@ -36,19 +36,9 @@ func ParseVMmServerID(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} - - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) - } - - if id.ResourceGroupName, ok = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) - } - - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if err := id.FromParseResult(*parsed); err != nil { + return nil, err } return &id, nil @@ -63,22 +53,30 @@ func ParseVMmServerIDInsensitively(input string) (*VMmServerId, error) { return nil, fmt.Errorf("parsing %q: %+v", input, err) } - var ok bool id := VMmServerId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} - if id.SubscriptionId, ok = parsed.Parsed["subscriptionId"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "subscriptionId", *parsed) +func (id *VMmServerId) 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 = parsed.Parsed["resourceGroupName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", *parsed) + if id.ResourceGroupName, ok = input.Parsed["resourceGroupName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "resourceGroupName", input) } - if id.VmmServerName, ok = parsed.Parsed["vmmServerName"]; !ok { - return nil, resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", *parsed) + if id.VmmServerName, ok = input.Parsed["vmmServerName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "vmmServerName", input) } - return &id, nil + return nil } // ValidateVMmServerID checks that 'input' can be parsed as a V Mm Server ID From ff527a89ae5b56cdf167166b49e7be29c14a0c06 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Mon, 18 Dec 2023 15:27:23 +0800 Subject: [PATCH 06/17] update code --- ...ystem_center_virtual_machine_manager_server.html.markdown | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown index 1f2dc977c359..810a5280821f 100644 --- a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -26,6 +26,11 @@ resource "azurerm_system_center_virtual_machine_manager_server" "example" { location = azurerm_resource_group.example.location custom_location_id = "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1" fqdn = "example.labtest" + + credential { + username = "testUser" + password = "H@Sh1CoR3!" + } } ``` From 14231a07850a781437d730f060c39f9bc5b6166f Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Thu, 21 Dec 2023 14:47:19 +0800 Subject: [PATCH 07/17] update code --- .../parse/custom_location.go | 72 --------- .../parse/custom_location_test.go | 115 --------------- .../resourceids.go | 3 - ...virtual_machine_manager_server_resource.go | 94 ++++-------- ...al_machine_manager_server_resource_test.go | 61 +++++--- .../validate/custom_location_id.go | 26 ---- .../validate/custom_location_id_test.go | 79 ---------- .../2021-08-15/customlocations/README.md | 137 ++++++++++++++++++ .../2021-08-15/customlocations/client.go | 26 ++++ .../2021-08-15/customlocations/constants.go | 48 ++++++ .../customlocations/id_customlocation.go | 125 ++++++++++++++++ .../customlocations/method_createorupdate.go | 74 ++++++++++ .../customlocations/method_delete.go | 70 +++++++++ .../2021-08-15/customlocations/method_get.go | 51 +++++++ .../method_listbyresourcegroup.go | 90 ++++++++++++ .../method_listbysubscription.go | 90 ++++++++++++ .../method_listenabledresourcetypes.go | 89 ++++++++++++ .../customlocations/method_update.go | 55 +++++++ .../customlocations/model_customlocation.go | 20 +++ .../model_customlocationproperties.go | 14 ++ ..._customlocationpropertiesauthentication.go | 9 ++ .../model_enabledresourcetype.go | 16 ++ .../model_enabledresourcetypeproperties.go | 10 ++ ...ourcetypepropertiestypesmetadatainlined.go | 10 ++ .../model_patchablecustomlocations.go | 14 ++ .../2021-08-15/customlocations/predicates.go | 55 +++++++ .../2021-08-15/customlocations/version.go | 12 ++ vendor/modules.txt | 1 + ...rtual_machine_manager_server.html.markdown | 16 +- 29 files changed, 1095 insertions(+), 387 deletions(-) delete mode 100644 internal/services/systemcentervirtualmachinemanager/parse/custom_location.go delete mode 100644 internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go delete mode 100644 internal/services/systemcentervirtualmachinemanager/resourceids.go delete mode 100644 internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go delete mode 100644 internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_get.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/version.go diff --git a/internal/services/systemcentervirtualmachinemanager/parse/custom_location.go b/internal/services/systemcentervirtualmachinemanager/parse/custom_location.go deleted file mode 100644 index 942d1d3098ea..000000000000 --- a/internal/services/systemcentervirtualmachinemanager/parse/custom_location.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type CustomLocationId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewCustomLocationID(subscriptionId, resourceGroup, name string) CustomLocationId { - return CustomLocationId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id CustomLocationId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Custom Location", segmentsStr) -} - -func (id CustomLocationId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ExtendedLocation/customLocations/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// CustomLocationID parses a CustomLocation ID into an CustomLocationId struct -func CustomLocationID(input string) (*CustomLocationId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an CustomLocation ID: %+v", input, err) - } - - resourceId := CustomLocationId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("customLocations"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go b/internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go deleted file mode 100644 index 29b50e997d4b..000000000000 --- a/internal/services/systemcentervirtualmachinemanager/parse/custom_location_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = CustomLocationId{} - -func TestCustomLocationIDFormatter(t *testing.T) { - actual := NewCustomLocationID("12345678-1234-9876-4563-123456789012", "resGroup1", "customLocation1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestCustomLocationID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *CustomLocationId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1", - Expected: &CustomLocationId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "customLocation1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.EXTENDEDLOCATION/CUSTOMLOCATIONS/CUSTOMLOCATION1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := CustomLocationID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/systemcentervirtualmachinemanager/resourceids.go b/internal/services/systemcentervirtualmachinemanager/resourceids.go deleted file mode 100644 index a0fa7a3f52fa..000000000000 --- a/internal/services/systemcentervirtualmachinemanager/resourceids.go +++ /dev/null @@ -1,3 +0,0 @@ -package systemcentervirtualmachinemanager - -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=CustomLocation -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1 diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go index 4e7c7a497b6e..a268563f8587 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/go-azure-helpers/lang/response" "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema" "github.com/hashicorp/go-azure-helpers/resourcemanager/location" + "github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations" "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07/vmmservers" "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/validate" @@ -23,16 +24,12 @@ type SystemCenterVirtualMachineManagerServerModel struct { Location string `tfschema:"location"` CustomLocationId string `tfschema:"custom_location_id"` Fqdn string `tfschema:"fqdn"` - Credential []Credential `tfschema:"credential"` + Username string `tfschema:"username"` + Password string `tfschema:"password"` Port int `tfschema:"port"` Tags map[string]string `tfschema:"tags"` } -type Credential struct { - Username string `tfschema:"username"` - Password string `tfschema:"password"` -} - var _ sdk.Resource = SystemCenterVirtualMachineManagerServerResource{} var _ sdk.ResourceWithUpdate = SystemCenterVirtualMachineManagerServerResource{} @@ -63,41 +60,32 @@ func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string] "location": commonschema.Location(), - "credential": { - Type: pluginsdk.TypeList, - Required: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "username": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringIsNotEmpty, - }, + "custom_location_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: customlocations.ValidateCustomLocationID, + }, - "password": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - Sensitive: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - }, - }, + "fqdn": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, }, - "custom_location_id": { + "username": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.CustomLocationID, + ValidateFunc: validation.StringIsNotEmpty, }, - "fqdn": { + "password": { Type: pluginsdk.TypeString, Required: true, ForceNew: true, + Sensitive: true, ValidateFunc: validation.StringIsNotEmpty, }, @@ -143,12 +131,15 @@ func (r SystemCenterVirtualMachineManagerServerResource) Create() sdk.ResourceFu parameters := &vmmservers.VMMServer{ Location: location.Normalize(model.Location), ExtendedLocation: vmmservers.ExtendedLocation{ - Type: utils.String("customLocation"), - Name: utils.String(model.CustomLocationId), + Type: pointer.To("customLocation"), + Name: pointer.To(model.CustomLocationId), }, Properties: vmmservers.VMMServerProperties{ - Credentials: expandSystemCenterVirtualMachineManagerServerCredential(model.Credential), - Fqdn: model.Fqdn, + Credentials: &vmmservers.VMMCredential{ + Username: pointer.To(model.Username), + Password: pointer.To(model.Password), + }, + Fqdn: model.Fqdn, }, Tags: pointer.To(model.Tags), } @@ -193,9 +184,13 @@ func (r SystemCenterVirtualMachineManagerServerResource) Read() sdk.ResourceFunc state.Location = location.Normalize(model.Location) state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) state.Fqdn = model.Properties.Fqdn - state.Credential = flattenSystemCenterVirtualMachineManagerServerCredential(model.Properties.Credentials, metadata.ResourceData.Get("credential.0.password").(string)) + state.Password = metadata.ResourceData.Get("credential.0.password").(string) state.Tags = pointer.From(model.Tags) + if v := model.Properties.Credentials; v != nil { + state.Username = pointer.From(v.Username) + } + if v := model.Properties.Port; v != nil { state.Port = int(*v) } @@ -254,32 +249,3 @@ func (r SystemCenterVirtualMachineManagerServerResource) Delete() sdk.ResourceFu }, } } - -func expandSystemCenterVirtualMachineManagerServerCredential(input []Credential) *vmmservers.VMMCredential { - if len(input) == 0 { - return nil - } - - credential := &input[0] - - result := &vmmservers.VMMCredential{ - Username: pointer.To(credential.Username), - Password: pointer.To(credential.Password), - } - - return result -} - -func flattenSystemCenterVirtualMachineManagerServerCredential(input *vmmservers.VMMCredential, password string) []Credential { - result := make([]Credential, 0) - if input == nil { - return result - } - - credential := Credential{ - Username: pointer.From(input.Username), - Password: password, - } - - return append(result, credential) -} diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go index 6b8c2aa5284e..17c482c74751 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -69,7 +69,7 @@ func testAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { - Config: r.complete(data, "Test"), + Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -84,14 +84,14 @@ func testAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { data.ResourceSequentialTest(t, r, []acceptance.TestStep{ { - Config: r.complete(data, "Test"), + Config: r.complete(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, data.ImportStep("credential.0.password"), { - Config: r.complete(data, "Test2"), + Config: r.update(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), @@ -118,6 +118,10 @@ func (r SystemCenterVirtualMachineManagerServerResource) basic(data acceptance.T return fmt.Sprintf(` %s +provider "azurerm" { + features {} +} + resource "azurerm_system_center_virtual_machine_manager_server" "test" { name = "acctest-scvmmms-%d" resource_group_name = azurerm_resource_group.test.name @@ -137,25 +141,30 @@ func (r SystemCenterVirtualMachineManagerServerResource) requiresImport(data acc return fmt.Sprintf(` %s +provider "azurerm" { + features {} +} + resource "azurerm_system_center_virtual_machine_manager_server" "import" { name = azurerm_system_center_virtual_machine_manager_server.test.name resource_group_name = azurerm_system_center_virtual_machine_manager_server.test.resource_group_name location = azurerm_system_center_virtual_machine_manager_server.test.location custom_location_id = azurerm_system_center_virtual_machine_manager_server.test.custom_location_id fqdn = azurerm_system_center_virtual_machine_manager_server.test.fqdn - - credential { - username = "%s" - password = "%s" - } + username = "%s" + password = "%s" } `, r.basic(data), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } -func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData, tag string) string { +func (r SystemCenterVirtualMachineManagerServerResource) complete(data acceptance.TestData) string { return fmt.Sprintf(` %s +provider "azurerm" { + features {} +} + resource "azurerm_system_center_virtual_machine_manager_server" "test" { name = "acctest-scvmmms-%d" resource_group_name = azurerm_resource_group.test.name @@ -163,25 +172,43 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { custom_location_id = "%s" fqdn = "%s" port = tonumber("%s") - - credential { - username = "%s" - password = "%s" - } + username = "%s" + password = "%s" tags = { - Env = "%s" + Env = "Test" } } -`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD"), tag) +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } -func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { +func (r SystemCenterVirtualMachineManagerServerResource) update(data acceptance.TestData) string { return fmt.Sprintf(` +%s + provider "azurerm" { features {} } +resource "azurerm_system_center_virtual_machine_manager_server" "test" { + name = "acctest-scvmmms-%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + custom_location_id = "%s" + fqdn = "%s" + port = tonumber("%s") + username = "%s" + password = "%s" + + tags = { + Env = "Test2" + } +} +`, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_PORT"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) +} + +func (r SystemCenterVirtualMachineManagerServerResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestrg-scvmmms-%d" location = "%s" diff --git a/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go b/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go deleted file mode 100644 index 3a9c4d483365..000000000000 --- a/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/parse" -) - -func CustomLocationID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.CustomLocationID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go b/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go deleted file mode 100644 index 51c0ca895f51..000000000000 --- a/internal/services/systemcentervirtualmachinemanager/validate/custom_location_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestCustomLocationID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.ExtendedLocation/customLocations/customLocation1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.EXTENDEDLOCATION/CUSTOMLOCATIONS/CUSTOMLOCATION1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := CustomLocationID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md new file mode 100644 index 000000000000..3f56bf0f4e5c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/README.md @@ -0,0 +1,137 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations` Documentation + +The `customlocations` SDK allows for interaction with the Azure Resource Manager Service `extendedlocation` (API Version `2021-08-15`). + +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/extendedlocation/2021-08-15/customlocations" +``` + + +### Client Initialization + +```go +client := customlocations.NewCustomLocationsClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `CustomLocationsClient.CreateOrUpdate` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +payload := customlocations.CustomLocation{ + // ... +} + + +if err := client.CreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `CustomLocationsClient.Delete` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +if err := client.DeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `CustomLocationsClient.Get` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +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: `CustomLocationsClient.ListByResourceGroup` + +```go +ctx := context.TODO() +id := customlocations.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: `CustomLocationsClient.ListBySubscription` + +```go +ctx := context.TODO() +id := customlocations.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: `CustomLocationsClient.ListEnabledResourceTypes` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +// alternatively `client.ListEnabledResourceTypes(ctx, id)` can be used to do batched pagination +items, err := client.ListEnabledResourceTypesComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` + + +### Example Usage: `CustomLocationsClient.Update` + +```go +ctx := context.TODO() +id := customlocations.NewCustomLocationID("12345678-1234-9876-4563-123456789012", "example-resource-group", "customLocationValue") + +payload := customlocations.PatchableCustomLocations{ + // ... +} + + +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/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/client.go new file mode 100644 index 000000000000..bd1bcb809a51 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/client.go @@ -0,0 +1,26 @@ +package customlocations + +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 CustomLocationsClient struct { + Client *resourcemanager.Client +} + +func NewCustomLocationsClientWithBaseURI(sdkApi sdkEnv.Api) (*CustomLocationsClient, error) { + client, err := resourcemanager.NewResourceManagerClient(sdkApi, "customlocations", defaultApiVersion) + if err != nil { + return nil, fmt.Errorf("instantiating CustomLocationsClient: %+v", err) + } + + return &CustomLocationsClient{ + Client: client, + }, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go new file mode 100644 index 000000000000..45e439f98aae --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/constants.go @@ -0,0 +1,48 @@ +package customlocations + +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 HostType string + +const ( + HostTypeKubernetes HostType = "Kubernetes" +) + +func PossibleValuesForHostType() []string { + return []string{ + string(HostTypeKubernetes), + } +} + +func (s *HostType) UnmarshalJSON(bytes []byte) error { + var decoded string + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling: %+v", err) + } + out, err := parseHostType(decoded) + if err != nil { + return fmt.Errorf("parsing %q: %+v", decoded, err) + } + *s = *out + return nil +} + +func parseHostType(input string) (*HostType, error) { + vals := map[string]HostType{ + "kubernetes": HostTypeKubernetes, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := HostType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go new file mode 100644 index 000000000000..2dcae63d1c91 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/id_customlocation.go @@ -0,0 +1,125 @@ +package customlocations + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ resourceids.ResourceId = CustomLocationId{} + +// CustomLocationId is a struct representing the Resource ID for a Custom Location +type CustomLocationId struct { + SubscriptionId string + ResourceGroupName string + CustomLocationName string +} + +// NewCustomLocationID returns a new CustomLocationId struct +func NewCustomLocationID(subscriptionId string, resourceGroupName string, customLocationName string) CustomLocationId { + return CustomLocationId{ + SubscriptionId: subscriptionId, + ResourceGroupName: resourceGroupName, + CustomLocationName: customLocationName, + } +} + +// ParseCustomLocationID parses 'input' into a CustomLocationId +func ParseCustomLocationID(input string) (*CustomLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(CustomLocationId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CustomLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +// ParseCustomLocationIDInsensitively parses 'input' case-insensitively into a CustomLocationId +// note: this method should only be used for API response data and not user input +func ParseCustomLocationIDInsensitively(input string) (*CustomLocationId, error) { + parser := resourceids.NewParserFromResourceIdType(CustomLocationId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + id := CustomLocationId{} + if err := id.FromParseResult(*parsed); err != nil { + return nil, err + } + + return &id, nil +} + +func (id *CustomLocationId) 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.CustomLocationName, ok = input.Parsed["customLocationName"]; !ok { + return resourceids.NewSegmentNotSpecifiedError(id, "customLocationName", input) + } + + return nil +} + +// ValidateCustomLocationID checks that 'input' can be parsed as a Custom Location ID +func ValidateCustomLocationID(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 := ParseCustomLocationID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Custom Location ID +func (id CustomLocationId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.ExtendedLocation/customLocations/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroupName, id.CustomLocationName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Custom Location ID +func (id CustomLocationId) 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("staticMicrosoftExtendedLocation", "Microsoft.ExtendedLocation", "Microsoft.ExtendedLocation"), + resourceids.StaticSegment("staticCustomLocations", "customLocations", "customLocations"), + resourceids.UserSpecifiedSegment("customLocationName", "customLocationValue"), + } +} + +// String returns a human-readable description of this Custom Location ID +func (id CustomLocationId) String() string { + components := []string{ + fmt.Sprintf("Subscription: %q", id.SubscriptionId), + fmt.Sprintf("Resource Group Name: %q", id.ResourceGroupName), + fmt.Sprintf("Custom Location Name: %q", id.CustomLocationName), + } + return fmt.Sprintf("Custom Location (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go new file mode 100644 index 000000000000..2f160e0faa7e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_createorupdate.go @@ -0,0 +1,74 @@ +package customlocations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/odata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CreateOrUpdateOperationResponse struct { + Poller pollers.Poller + HttpResponse *http.Response + OData *odata.OData +} + +// CreateOrUpdate ... +func (c CustomLocationsClient) CreateOrUpdate(ctx context.Context, id CustomLocationId, input CustomLocation) (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 CustomLocationsClient) CreateOrUpdateThenPoll(ctx context.Context, id CustomLocationId, input CustomLocation) error { + result, err := c.CreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing CreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after CreateOrUpdate: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go new file mode 100644 index 000000000000..46eca9192ec6 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_delete.go @@ -0,0 +1,70 @@ +package customlocations + +import ( + "context" + "fmt" + "net/http" + + "github.com/hashicorp/go-azure-sdk/sdk/client" + "github.com/hashicorp/go-azure-sdk/sdk/client/pollers" + "github.com/hashicorp/go-azure-sdk/sdk/client/resourcemanager" + "github.com/hashicorp/go-azure-sdk/sdk/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 CustomLocationsClient) Delete(ctx context.Context, id CustomLocationId) (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 CustomLocationsClient) DeleteThenPoll(ctx context.Context, id CustomLocationId) error { + result, err := c.Delete(ctx, id) + if err != nil { + return fmt.Errorf("performing Delete: %+v", err) + } + + if err := result.Poller.PollUntilDone(ctx); err != nil { + return fmt.Errorf("polling after Delete: %+v", err) + } + + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_get.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_get.go new file mode 100644 index 000000000000..ebf3e87791be --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_get.go @@ -0,0 +1,51 @@ +package customlocations + +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 *CustomLocation +} + +// Get ... +func (c CustomLocationsClient) Get(ctx context.Context, id CustomLocationId) (result GetOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: id.ID(), + } + + req, err := c.Client.NewRequest(ctx, opts) + if err != nil { + return + } + + var resp *client.Response + resp, err = req.Execute(ctx) + if resp != nil { + result.OData = resp.OData + result.HttpResponse = resp.Response + } + if err != nil { + return + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go new file mode 100644 index 000000000000..5637a2b48bcd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbyresourcegroup.go @@ -0,0 +1,90 @@ +package customlocations + +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 *[]CustomLocation +} + +type ListByResourceGroupCompleteResult struct { + Items []CustomLocation +} + +// ListByResourceGroup ... +func (c CustomLocationsClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ExtendedLocation/customLocations", 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 *[]CustomLocation `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 CustomLocationsClient) ListByResourceGroupComplete(ctx context.Context, id commonids.ResourceGroupId) (ListByResourceGroupCompleteResult, error) { + return c.ListByResourceGroupCompleteMatchingPredicate(ctx, id, CustomLocationOperationPredicate{}) +} + +// ListByResourceGroupCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CustomLocationsClient) ListByResourceGroupCompleteMatchingPredicate(ctx context.Context, id commonids.ResourceGroupId, predicate CustomLocationOperationPredicate) (result ListByResourceGroupCompleteResult, err error) { + items := make([]CustomLocation, 0) + + resp, err := c.ListByResourceGroup(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListByResourceGroupCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go new file mode 100644 index 000000000000..2c5015119ac4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listbysubscription.go @@ -0,0 +1,90 @@ +package customlocations + +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 *[]CustomLocation +} + +type ListBySubscriptionCompleteResult struct { + Items []CustomLocation +} + +// ListBySubscription ... +func (c CustomLocationsClient) 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, + Path: fmt.Sprintf("%s/providers/Microsoft.ExtendedLocation/customLocations", 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 *[]CustomLocation `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 CustomLocationsClient) ListBySubscriptionComplete(ctx context.Context, id commonids.SubscriptionId) (ListBySubscriptionCompleteResult, error) { + return c.ListBySubscriptionCompleteMatchingPredicate(ctx, id, CustomLocationOperationPredicate{}) +} + +// ListBySubscriptionCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CustomLocationsClient) ListBySubscriptionCompleteMatchingPredicate(ctx context.Context, id commonids.SubscriptionId, predicate CustomLocationOperationPredicate) (result ListBySubscriptionCompleteResult, err error) { + items := make([]CustomLocation, 0) + + resp, err := c.ListBySubscription(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListBySubscriptionCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go new file mode 100644 index 000000000000..1e20cc9e1ebb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_listenabledresourcetypes.go @@ -0,0 +1,89 @@ +package customlocations + +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 ListEnabledResourceTypesOperationResponse struct { + HttpResponse *http.Response + OData *odata.OData + Model *[]EnabledResourceType +} + +type ListEnabledResourceTypesCompleteResult struct { + Items []EnabledResourceType +} + +// ListEnabledResourceTypes ... +func (c CustomLocationsClient) ListEnabledResourceTypes(ctx context.Context, id CustomLocationId) (result ListEnabledResourceTypesOperationResponse, err error) { + opts := client.RequestOptions{ + ContentType: "application/json; charset=utf-8", + ExpectedStatusCodes: []int{ + http.StatusOK, + }, + HttpMethod: http.MethodGet, + Path: fmt.Sprintf("%s/enabledResourceTypes", 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 *[]EnabledResourceType `json:"value"` + } + if err = resp.Unmarshal(&values); err != nil { + return + } + + result.Model = values.Values + + return +} + +// ListEnabledResourceTypesComplete retrieves all the results into a single object +func (c CustomLocationsClient) ListEnabledResourceTypesComplete(ctx context.Context, id CustomLocationId) (ListEnabledResourceTypesCompleteResult, error) { + return c.ListEnabledResourceTypesCompleteMatchingPredicate(ctx, id, EnabledResourceTypeOperationPredicate{}) +} + +// ListEnabledResourceTypesCompleteMatchingPredicate retrieves all the results and then applies the predicate +func (c CustomLocationsClient) ListEnabledResourceTypesCompleteMatchingPredicate(ctx context.Context, id CustomLocationId, predicate EnabledResourceTypeOperationPredicate) (result ListEnabledResourceTypesCompleteResult, err error) { + items := make([]EnabledResourceType, 0) + + resp, err := c.ListEnabledResourceTypes(ctx, id) + if err != nil { + err = fmt.Errorf("loading results: %+v", err) + return + } + if resp.Model != nil { + for _, v := range *resp.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + result = ListEnabledResourceTypesCompleteResult{ + Items: items, + } + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go new file mode 100644 index 000000000000..8a0507b08541 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/method_update.go @@ -0,0 +1,55 @@ +package customlocations + +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 *CustomLocation +} + +// Update ... +func (c CustomLocationsClient) Update(ctx context.Context, id CustomLocationId, input PatchableCustomLocations) (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 + } + + if err = resp.Unmarshal(&result.Model); err != nil { + return + } + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go new file mode 100644 index 000000000000..1206e9eb6355 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocation.go @@ -0,0 +1,20 @@ +package customlocations + +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 CustomLocation struct { + Id *string `json:"id,omitempty"` + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Location string `json:"location"` + Name *string `json:"name,omitempty"` + Properties *CustomLocationProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go new file mode 100644 index 000000000000..8a1b9867bd69 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationproperties.go @@ -0,0 +1,14 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomLocationProperties struct { + Authentication *CustomLocationPropertiesAuthentication `json:"authentication,omitempty"` + ClusterExtensionIds *[]string `json:"clusterExtensionIds,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + HostResourceId *string `json:"hostResourceId,omitempty"` + HostType *HostType `json:"hostType,omitempty"` + Namespace *string `json:"namespace,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go new file mode 100644 index 000000000000..506f39031812 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_customlocationpropertiesauthentication.go @@ -0,0 +1,9 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomLocationPropertiesAuthentication struct { + Type *string `json:"type,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go new file mode 100644 index 000000000000..ea81da07f08f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetype.go @@ -0,0 +1,16 @@ +package customlocations + +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 EnabledResourceType struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties *EnabledResourceTypeProperties `json:"properties,omitempty"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go new file mode 100644 index 000000000000..54b0f3198811 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypeproperties.go @@ -0,0 +1,10 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnabledResourceTypeProperties struct { + ClusterExtensionId *string `json:"clusterExtensionId,omitempty"` + ExtensionType *string `json:"extensionType,omitempty"` + TypesMetadata *[]EnabledResourceTypePropertiesTypesMetadataInlined `json:"typesMetadata,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go new file mode 100644 index 000000000000..5998090bd271 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_enabledresourcetypepropertiestypesmetadatainlined.go @@ -0,0 +1,10 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type EnabledResourceTypePropertiesTypesMetadataInlined struct { + ApiVersion *string `json:"apiVersion,omitempty"` + ResourceProviderNamespace *string `json:"resourceProviderNamespace,omitempty"` + ResourceType *string `json:"resourceType,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go new file mode 100644 index 000000000000..005fda74441b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/model_patchablecustomlocations.go @@ -0,0 +1,14 @@ +package customlocations + +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 PatchableCustomLocations struct { + Identity *identity.SystemAssigned `json:"identity,omitempty"` + Properties *CustomLocationProperties `json:"properties,omitempty"` + Tags *map[string]string `json:"tags,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go new file mode 100644 index 000000000000..f18b5aa943f1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/predicates.go @@ -0,0 +1,55 @@ +package customlocations + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type CustomLocationOperationPredicate struct { + Id *string + Location *string + Name *string + Type *string +} + +func (p CustomLocationOperationPredicate) Matches(input CustomLocation) 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 +} + +type EnabledResourceTypeOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p EnabledResourceTypeOperationPredicate) Matches(input EnabledResourceType) bool { + + if p.Id != nil && (input.Id == nil || *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil || *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil || *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/version.go new file mode 100644 index 000000000000..efff5cadda05 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations/version.go @@ -0,0 +1,12 @@ +package customlocations + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2021-08-15" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/customlocations/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index 48643e2d8c13..6eea0a2f1263 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -490,6 +490,7 @@ github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/namespace github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/networkrulesets github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2021-11-01/schemaregistry github.com/hashicorp/go-azure-sdk/resource-manager/eventhub/2022-01-01-preview/namespaces +github.com/hashicorp/go-azure-sdk/resource-manager/extendedlocation/2021-08-15/customlocations github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26 github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelaycontainers github.com/hashicorp/go-azure-sdk/resource-manager/fluidrelay/2022-05-26/fluidrelayservers diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown index 810a5280821f..817d0106bc19 100644 --- a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -38,30 +38,24 @@ resource "azurerm_system_center_virtual_machine_manager_server" "example" { The following arguments are supported: -* `name` - (Required) The name which should be used for this System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. +* `name` - (Required) The name of the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. * `resource_group_name` - (Required) The name of the Resource Group where the System Center Virtual Machine Manager should exist. Changing this forces a new resource to be created. * `location` - (Required) The Azure Region where the System Center Virtual Machine Manager Server should exist. Changing this forces a new resource to be created. -* `credential` - (Required) A `credential` block as defined below. - * `custom_location_id` - (Required) The ID of the Custom Location for the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. * `fqdn` - (Required) The FQDN of the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. -* `port` - (Optional) The port that is used to listened by the System Center Virtual Machine Manager Server. Possible values are between `1` and `65535`. Changing this forces a new resource to be created. - -* `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Server. - ---- - -A `credential` block supports the following: - * `username` - (Required) The username that is used to connect to the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. * `password` - (Required) The password that is used to connect to the System Center Virtual Machine Manager Server. Changing this forces a new resource to be created. +* `port` - (Optional) The port on which the System Center Virtual Machine Manager Server is listening. Possible values are between `1` and `65535`. Changing this forces a new resource to be created. + +* `tags` - (Optional) A mapping of tags which should be assigned to the System Center Virtual Machine Manager Server. + ## Attributes Reference In addition to the Arguments listed above - the following Attributes are exported: From 8b231cedfd57695d61ef8ae9e48ca03e0a555f18 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Thu, 21 Dec 2023 16:18:05 +0800 Subject: [PATCH 08/17] update code --- ...virtual_machine_manager_server_resource.go | 9 +++------ ...al_machine_manager_server_resource_test.go | 19 ++++++------------- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go index a268563f8587..deae7021b039 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -15,7 +15,6 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/systemcentervirtualmachinemanager/validate" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" - "github.com/hashicorp/terraform-provider-azurerm/utils" ) type SystemCenterVirtualMachineManagerServerModel struct { @@ -145,7 +144,7 @@ func (r SystemCenterVirtualMachineManagerServerResource) Create() sdk.ResourceFu } if v := model.Port; v != 0 { - parameters.Properties.Port = utils.Int64(int64(v)) + parameters.Properties.Port = pointer.To(int64(v)) } if err := client.CreateOrUpdateThenPoll(ctx, id, *parameters); err != nil { @@ -184,16 +183,14 @@ func (r SystemCenterVirtualMachineManagerServerResource) Read() sdk.ResourceFunc state.Location = location.Normalize(model.Location) state.CustomLocationId = pointer.From(model.ExtendedLocation.Name) state.Fqdn = model.Properties.Fqdn - state.Password = metadata.ResourceData.Get("credential.0.password").(string) + state.Password = metadata.ResourceData.Get("password").(string) + state.Port = int(pointer.From(model.Properties.Port)) state.Tags = pointer.From(model.Tags) if v := model.Properties.Credentials; v != nil { state.Username = pointer.From(v.Username) } - if v := model.Properties.Port; v != nil { - state.Port = int(*v) - } } return metadata.Encode(&state) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go index 17c482c74751..17e374a3f0d3 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource_test.go @@ -44,7 +44,7 @@ func testAccSystemCenterVirtualMachineManagerServer_basic(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep("credential.0.password"), + data.ImportStep("password"), }) } @@ -74,7 +74,7 @@ func testAccSystemCenterVirtualMachineManagerServer_complete(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep("credential.0.password"), + data.ImportStep("password"), }) } @@ -89,14 +89,14 @@ func testAccSystemCenterVirtualMachineManagerServer_update(t *testing.T) { check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep("credential.0.password"), + data.ImportStep("password"), { Config: r.update(data), Check: acceptance.ComposeTestCheckFunc( check.That(data.ResourceName).ExistsInAzure(r), ), }, - data.ImportStep("credential.0.password"), + data.ImportStep("password"), }) } @@ -128,11 +128,8 @@ resource "azurerm_system_center_virtual_machine_manager_server" "test" { location = azurerm_resource_group.test.location custom_location_id = "%s" fqdn = "%s" - - credential { - username = "%s" - password = "%s" - } + username = "%s" + password = "%s" } `, r.template(data), data.RandomInteger, os.Getenv("ARM_TEST_CUSTOM_LOCATION_ID"), os.Getenv("ARM_TEST_FQDN"), os.Getenv("ARM_TEST_USERNAME"), os.Getenv("ARM_TEST_PASSWORD")) } @@ -141,10 +138,6 @@ func (r SystemCenterVirtualMachineManagerServerResource) requiresImport(data acc return fmt.Sprintf(` %s -provider "azurerm" { - features {} -} - resource "azurerm_system_center_virtual_machine_manager_server" "import" { name = azurerm_system_center_virtual_machine_manager_server.test.name resource_group_name = azurerm_system_center_virtual_machine_manager_server.test.resource_group_name From 0f5cfa97e73e2e13e76282c205b3138122a1c990 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Mon, 25 Dec 2023 13:11:41 +0800 Subject: [PATCH 09/17] update code --- .github/labeler-pull-request-triage.yml | 4 +++- .../systemcentervirtualmachinemanager/registration.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/labeler-pull-request-triage.yml b/.github/labeler-pull-request-triage.yml index a87343415f06..1e31d887356b 100644 --- a/.github/labeler-pull-request-triage.yml +++ b/.github/labeler-pull-request-triage.yml @@ -566,7 +566,9 @@ service/synapse: - internal/services/synapse/**/* service/systemcentervirtualmachinemanager: - - internal/services/systemcentervirtualmachinemanager/**/* +- changed-files: + - any-glob-to-any-file: + - internal/services/systemcentervirtualmachinemanager/**/* service/traffic-manager: - changed-files: diff --git a/internal/services/systemcentervirtualmachinemanager/registration.go b/internal/services/systemcentervirtualmachinemanager/registration.go index dcb97a015b82..2ac8fef8b82e 100644 --- a/internal/services/systemcentervirtualmachinemanager/registration.go +++ b/internal/services/systemcentervirtualmachinemanager/registration.go @@ -6,7 +6,7 @@ import ( type Registration struct{} -var _ sdk.TypedServiceRegistrationWithAGitHubLabel = Registration{} +var _ sdk.TypedServiceRegistration = Registration{} func (r Registration) AssociatedGitHubLabel() string { return "service/systemcentervirtualmachinemanager" From 214caa175c8e225ccec69bd19a804599a4e2aad3 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Tue, 26 Dec 2023 15:30:59 +0800 Subject: [PATCH 10/17] update code --- .../system_center_virtual_machine_manager_server.html.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown index 817d0106bc19..38189b2a4121 100644 --- a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -12,6 +12,8 @@ Manages a System Center Virtual Machine Manager Server. ~> **Note:** By request of the service team the provider no longer automatically registering the `Microsoft.ScVmm` Resource Provider for this resource. To register it you can run `az provider register --namespace Microsoft.ScVmm`. +-> **Note:** The dependencies `System Center Virtual Machine Manager Host Machine`, `Arc Resource Bridge/Appliance` and `Custom Location` require additional configuration. For `System Center Virtual Machine Manager Host Machine`, see more details from [Virtual Machine Manager documentation](https://learn.microsoft.com/en-us/system-center/vmm/?view=sc-vmm-2022) and [Install VMM](https://learn.microsoft.com/en-us/system-center/vmm/install?view=sc-vmm-2022). For `Arc Resource Bridge/Appliance`, see more details from [What is Azure Arc resource bridge](https://learn.microsoft.com/en-us/azure/azure-arc/resource-bridge/overview) and [Overview of Arc-enabled System Center Virtual Machine Manager](https://learn.microsoft.com/en-us/azure/azure-arc/system-center-virtual-machine-manager/overview). For `Custom Location`, see more details from [Create and manage custom locations on Azure Arc-enabled Kubernetes](https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/custom-locations). If you encounter issues while configuring, we'd recommend opening a ticket with Microsoft Support. + ## Example Usage ```hcl From 1b231b027dd5e938e10d544384005c15e8644f5c Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 27 Dec 2023 08:12:05 +0800 Subject: [PATCH 11/17] update code --- .../system_center_virtual_machine_manager_server.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown index 38189b2a4121..c07d71c5f36e 100644 --- a/website/docs/r/system_center_virtual_machine_manager_server.html.markdown +++ b/website/docs/r/system_center_virtual_machine_manager_server.html.markdown @@ -12,7 +12,7 @@ Manages a System Center Virtual Machine Manager Server. ~> **Note:** By request of the service team the provider no longer automatically registering the `Microsoft.ScVmm` Resource Provider for this resource. To register it you can run `az provider register --namespace Microsoft.ScVmm`. --> **Note:** The dependencies `System Center Virtual Machine Manager Host Machine`, `Arc Resource Bridge/Appliance` and `Custom Location` require additional configuration. For `System Center Virtual Machine Manager Host Machine`, see more details from [Virtual Machine Manager documentation](https://learn.microsoft.com/en-us/system-center/vmm/?view=sc-vmm-2022) and [Install VMM](https://learn.microsoft.com/en-us/system-center/vmm/install?view=sc-vmm-2022). For `Arc Resource Bridge/Appliance`, see more details from [What is Azure Arc resource bridge](https://learn.microsoft.com/en-us/azure/azure-arc/resource-bridge/overview) and [Overview of Arc-enabled System Center Virtual Machine Manager](https://learn.microsoft.com/en-us/azure/azure-arc/system-center-virtual-machine-manager/overview). For `Custom Location`, see more details from [Create and manage custom locations on Azure Arc-enabled Kubernetes](https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/custom-locations). If you encounter issues while configuring, we'd recommend opening a ticket with Microsoft Support. +-> **Note:** This resource depends on an existing `System Center Virtual Machine Manager Host Machine`, `Arc Resource Bridge` and `Custom Location`. Installing and configuring these dependencies is outside the scope of this document. See [Virtual Machine Manager documentation](https://learn.microsoft.com/en-us/system-center/vmm/?view=sc-vmm-2022) and [Install VMM](https://learn.microsoft.com/en-us/system-center/vmm/install?view=sc-vmm-2022) for more details of `System Center Virtual Machine Manager Host Machine`. See [What is Azure Arc resource bridge](https://learn.microsoft.com/en-us/azure/azure-arc/resource-bridge/overview) and [Overview of Arc-enabled System Center Virtual Machine Manager](https://learn.microsoft.com/en-us/azure/azure-arc/system-center-virtual-machine-manager/overview) for more details of `Arc Resource Bridge/Appliance`. See [Create and manage custom locations on Azure Arc-enabled Kubernetes](https://learn.microsoft.com/en-us/azure/azure-arc/kubernetes/custom-locations) for more details of `Custom Location`. If you encounter issues while configuring, we'd recommend opening a ticket with Microsoft Support. ## Example Usage From 655c2c53752da41ec9b1797bb530c53d8b2cd8d6 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 27 Dec 2023 16:42:17 +0800 Subject: [PATCH 12/17] update code --- ...ystem_center_virtual_machine_manager_server_resource.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go index deae7021b039..f991e3c571ac 100644 --- a/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go +++ b/internal/services/systemcentervirtualmachinemanager/system_center_virtual_machine_manager_server_resource.go @@ -59,12 +59,7 @@ func (r SystemCenterVirtualMachineManagerServerResource) Arguments() map[string] "location": commonschema.Location(), - "custom_location_id": { - Type: pluginsdk.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: customlocations.ValidateCustomLocationID, - }, + "custom_location_id": commonschema.ResourceIDReferenceRequiredForceNew(customlocations.CustomLocationId{}), "fqdn": { Type: pluginsdk.TypeString, From 3b77b19d868b1faa99f779bc24e9d06711e3fbd9 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Sat, 27 Jan 2024 15:07:59 +0800 Subject: [PATCH 13/17] update code --- .../loadbalancer/parse/load_balancer_test.go | 232 ++++++++++++++++++ .../validate/load_balancer_id_test.go | 79 ++++++ 2 files changed, 311 insertions(+) create mode 100644 internal/services/loadbalancer/parse/load_balancer_test.go create mode 100644 internal/services/loadbalancer/validate/load_balancer_id_test.go diff --git a/internal/services/loadbalancer/parse/load_balancer_test.go b/internal/services/loadbalancer/parse/load_balancer_test.go new file mode 100644 index 000000000000..be3636c47641 --- /dev/null +++ b/internal/services/loadbalancer/parse/load_balancer_test.go @@ -0,0 +1,232 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "testing" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.Id = LoadBalancerId{} + +func TestLoadBalancerIDFormatter(t *testing.T) { + actual := NewLoadBalancerID("12345678-1234-9876-4563-123456789012", "resGroup1", "loadBalancer1").ID() + expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1" + if actual != expected { + t.Fatalf("Expected %q but got %q", expected, actual) + } +} + +func TestLoadBalancerID(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LoadBalancerId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1", + Expected: &LoadBalancerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "loadBalancer1", + }, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/LOADBALANCERS/LOADBALANCER1", + Error: true, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := LoadBalancerID(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.Name != v.Expected.Name { + t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) + } + } +} + +func TestLoadBalancerIDInsensitively(t *testing.T) { + testData := []struct { + Input string + Error bool + Expected *LoadBalancerId + }{ + + { + // empty + Input: "", + Error: true, + }, + + { + // missing SubscriptionId + Input: "/", + Error: true, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Error: true, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Error: true, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Error: true, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Error: true, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/", + Error: true, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1", + Expected: &LoadBalancerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "loadBalancer1", + }, + }, + + { + // lower-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadbalancers/loadBalancer1", + Expected: &LoadBalancerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "loadBalancer1", + }, + }, + + { + // upper-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/LOADBALANCERS/loadBalancer1", + Expected: &LoadBalancerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "loadBalancer1", + }, + }, + + { + // mixed-cased segment names + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/LoAdBaLaNcErS/loadBalancer1", + Expected: &LoadBalancerId{ + SubscriptionId: "12345678-1234-9876-4563-123456789012", + ResourceGroup: "resGroup1", + Name: "loadBalancer1", + }, + }, + } + + for _, v := range testData { + t.Logf("[DEBUG] Testing %q", v.Input) + + actual, err := LoadBalancerIDInsensitively(v.Input) + if err != nil { + if v.Error { + continue + } + + t.Fatalf("Expect a value but got an error: %s", err) + } + if v.Error { + t.Fatal("Expect an error but didn't get one") + } + + if actual.SubscriptionId != v.Expected.SubscriptionId { + t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) + } + if actual.ResourceGroup != v.Expected.ResourceGroup { + t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) + } + if actual.Name != v.Expected.Name { + t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) + } + } +} diff --git a/internal/services/loadbalancer/validate/load_balancer_id_test.go b/internal/services/loadbalancer/validate/load_balancer_id_test.go new file mode 100644 index 000000000000..402862a0219f --- /dev/null +++ b/internal/services/loadbalancer/validate/load_balancer_id_test.go @@ -0,0 +1,79 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import "testing" + +func TestLoadBalancerID(t *testing.T) { + cases := []struct { + Input string + Valid bool + }{ + + { + // empty + Input: "", + Valid: false, + }, + + { + // missing SubscriptionId + Input: "/", + Valid: false, + }, + + { + // missing value for SubscriptionId + Input: "/subscriptions/", + Valid: false, + }, + + { + // missing ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", + Valid: false, + }, + + { + // missing value for ResourceGroup + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", + Valid: false, + }, + + { + // missing Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", + Valid: false, + }, + + { + // missing value for Name + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/", + Valid: false, + }, + + { + // valid + Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1", + Valid: true, + }, + + { + // upper-cased + Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/LOADBALANCERS/LOADBALANCER1", + Valid: false, + }, + } + for _, tc := range cases { + t.Logf("[DEBUG] Testing Value %s", tc.Input) + _, errors := LoadBalancerID(tc.Input, "test") + valid := len(errors) == 0 + + if tc.Valid != valid { + t.Fatalf("Expected %t but got %t", tc.Valid, valid) + } + } +} From 49450d2a67e40144c1af1ca0a11f8f11c6d23807 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Sun, 18 Feb 2024 11:52:21 +0800 Subject: [PATCH 14/17] update code --- internal/clients/client.go | 251 +++++++++++++++++++------------------ 1 file changed, 128 insertions(+), 123 deletions(-) diff --git a/internal/clients/client.go b/internal/clients/client.go index ea5656ccaab0..9a2d2c24f169 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -21,6 +21,7 @@ import ( redis_2023_08_01 "github.com/hashicorp/go-azure-sdk/resource-manager/redis/2023-08-01" servicenetworking_v2023_05_01_preview "github.com/hashicorp/go-azure-sdk/resource-manager/servicenetworking/2023-05-01-preview" storagecache_2023_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/storagecache/2023-05-01" + systemcentervirtualmachinemanager_2023_10_07 "github.com/hashicorp/go-azure-sdk/resource-manager/systemcentervirtualmachinemanager/2023-10-07" timeseriesinsights_v2020_05_15 "github.com/hashicorp/go-azure-sdk/resource-manager/timeseriesinsights/2020-05-15" "github.com/hashicorp/terraform-provider-azurerm/internal/common" "github.com/hashicorp/terraform-provider-azurerm/internal/features" @@ -158,129 +159,130 @@ type Client struct { Account *ResourceManagerAccount Features features.UserFeatures - AadB2c *aadb2c_v2021_04_01_preview.Client - Advisor *advisor.Client - AnalysisServices *analysisservices_v2017_08_01.Client - ApiManagement *apiManagement.Client - AppConfiguration *appConfiguration.Client - AppInsights *applicationInsights.Client - AppPlatform *appPlatform.Client - AppService *appService.Client - ArcKubernetes *arckubernetes.Client - ArcResourceBridge *arcResourceBridge.Client - Attestation *attestation.Client - Authorization *authorization.Client - Automanage *automanage.Client - Automation *automation.Client - AzureStackHCI *azurestackhci_v2023_08_01.Client - Batch *batch.Client - Blueprints *blueprints.Client - Bot *bot.Client - Cdn *cdn.Client - Cognitive *cognitiveServices.Client - Communication *communication.Client - Compute *compute.Client - ConfidentialLedger *confidentialledger.Client - Connections *connections.Client - Consumption *consumption.Client - ContainerApps *containerapps.Client - Containers *containerServices.Client - Cosmos *cosmosdb.Client - CostManagement *costmanagement.Client - CustomProviders *customproviders.Client - Dashboard *dashboard.Client - DatabaseMigration *datamigration.Client - DataBricks *databricks.Client - DataboxEdge *databoxedge.Client - Datadog *datadog_v2021_03_01.Client - DataFactory *datafactory.Client - DataProtection *dataprotection.Client - DataShare *datashare.Client - DesktopVirtualization *desktopvirtualization.Client - DevTestLabs *devtestlabs.Client - DigitalTwins *digitaltwins.Client - Disks *disks.Client - Dns *dns_v2018_05_01.Client - DomainServices *domainservices.Client - Elastic *elastic.Client - ElasticSan *elasticsan.Client - EventGrid *eventgrid_v2022_06_15.Client - Eventhub *eventhub.Client - FluidRelay *fluidrelay_2022_05_26.Client - Frontdoor *frontdoor.Client - Graph *graph.Client - HSM *hsm.Client - HDInsight *hdinsight_v2021_06_01.Client - HybridCompute *hybridcompute.Client - HealthCare *healthcare.Client - IoTCentral *iotcentral.Client - IoTHub *iothub.Client - IoTTimeSeriesInsights *timeseriesinsights_v2020_05_15.Client - KeyVault *keyvault.Client - Kusto *kusto.Client - LabService *labservice.Client - Legacy *legacy.Client - Lighthouse *lighthouse.Client - LoadBalancers *loadbalancers.Client - LogAnalytics *loganalytics.Client - Logic *logic.Client - Logz *logz.Client - MachineLearning *machinelearning.Client - Maintenance *maintenance.Client - ManagedApplication *managedapplication.Client - ManagementGroups *managementgroup.Client - ManagedHSMs *managedhsm.Client - Maps *maps.Client - MariaDB *mariadb.Client - Media *media.Client - MixedReality *mixedreality.Client - Monitor *monitor.Client - MobileNetwork *mobilenetwork.Client - MSSQL *mssql.Client - MSSQLManagedInstance *mssqlmanagedinstance.Client - MySQL *mysql.Client - NetApp *netapp.Client - Network *network.Client - NetworkFunction *networkfunction.Client - NewRelic *newrelic.Client - Nginx *nginx_2023_09_01.Client - NotificationHubs *notificationhub.Client - Orbital *orbital.Client - PaloAlto *paloalto.Client - Policy *policy.Client - Portal *portal.Client - Postgres *postgres.Client - PowerBI *powerBI.Client - PrivateDns *privatedns.Client - PrivateDnsResolver *dnsresolver.Client - Purview *purview.Client - RecoveryServices *recoveryServices.Client - RedHatOpenShift *redhatopenshift.Client - Redis *redis_2023_08_01.Client - RedisEnterprise *redisenterprise.Client - Relay *relay.Client - Resource *resource.Client - Search *search.Client - SecurityCenter *securityCenter.Client - Sentinel *sentinel.Client - ServiceBus *serviceBus.Client - ServiceConnector *serviceConnector.Client - ServiceFabric *serviceFabric.Client - ServiceFabricManaged *serviceFabricManaged.Client - ServiceNetworking *servicenetworking_v2023_05_01_preview.Client - SignalR *signalr.Client - Storage *storage.Client - StorageCache *storagecache_2023_05_01.Client - StorageMover *storageMover.Client - StreamAnalytics *streamAnalytics.Client - Subscription *subscription.Client - Sql *sql.Client - Synapse *synapse.Client - TrafficManager *trafficManager.Client - VideoAnalyzer *videoAnalyzer.Client - Vmware *vmware.Client - VoiceServices *voiceServices.Client - Web *web.Client + AadB2c *aadb2c_v2021_04_01_preview.Client + Advisor *advisor.Client + AnalysisServices *analysisservices_v2017_08_01.Client + ApiManagement *apiManagement.Client + AppConfiguration *appConfiguration.Client + AppInsights *applicationInsights.Client + AppPlatform *appPlatform.Client + AppService *appService.Client + ArcKubernetes *arckubernetes.Client + ArcResourceBridge *arcResourceBridge.Client + Attestation *attestation.Client + Authorization *authorization.Client + Automanage *automanage.Client + Automation *automation.Client + AzureStackHCI *azurestackhci_v2023_08_01.Client + Batch *batch.Client + Blueprints *blueprints.Client + Bot *bot.Client + Cdn *cdn.Client + Cognitive *cognitiveServices.Client + Communication *communication.Client + Compute *compute.Client + ConfidentialLedger *confidentialledger.Client + Connections *connections.Client + Consumption *consumption.Client + ContainerApps *containerapps.Client + Containers *containerServices.Client + Cosmos *cosmosdb.Client + CostManagement *costmanagement.Client + CustomProviders *customproviders.Client + Dashboard *dashboard.Client + DatabaseMigration *datamigration.Client + DataBricks *databricks.Client + DataboxEdge *databoxedge.Client + Datadog *datadog_v2021_03_01.Client + DataFactory *datafactory.Client + DataProtection *dataprotection.Client + DataShare *datashare.Client + DesktopVirtualization *desktopvirtualization.Client + DevTestLabs *devtestlabs.Client + DigitalTwins *digitaltwins.Client + Disks *disks.Client + Dns *dns_v2018_05_01.Client + DomainServices *domainservices.Client + Elastic *elastic.Client + ElasticSan *elasticsan.Client + EventGrid *eventgrid_v2022_06_15.Client + Eventhub *eventhub.Client + FluidRelay *fluidrelay_2022_05_26.Client + Frontdoor *frontdoor.Client + Graph *graph.Client + HSM *hsm.Client + HDInsight *hdinsight_v2021_06_01.Client + HybridCompute *hybridcompute.Client + HealthCare *healthcare.Client + IoTCentral *iotcentral.Client + IoTHub *iothub.Client + IoTTimeSeriesInsights *timeseriesinsights_v2020_05_15.Client + KeyVault *keyvault.Client + Kusto *kusto.Client + LabService *labservice.Client + Legacy *legacy.Client + Lighthouse *lighthouse.Client + LoadBalancers *loadbalancers.Client + LogAnalytics *loganalytics.Client + Logic *logic.Client + Logz *logz.Client + MachineLearning *machinelearning.Client + Maintenance *maintenance.Client + ManagedApplication *managedapplication.Client + ManagementGroups *managementgroup.Client + ManagedHSMs *managedhsm.Client + Maps *maps.Client + MariaDB *mariadb.Client + Media *media.Client + MixedReality *mixedreality.Client + Monitor *monitor.Client + MobileNetwork *mobilenetwork.Client + MSSQL *mssql.Client + MSSQLManagedInstance *mssqlmanagedinstance.Client + MySQL *mysql.Client + NetApp *netapp.Client + Network *network.Client + NetworkFunction *networkfunction.Client + NewRelic *newrelic.Client + Nginx *nginx_2023_09_01.Client + NotificationHubs *notificationhub.Client + Orbital *orbital.Client + PaloAlto *paloalto.Client + Policy *policy.Client + Portal *portal.Client + Postgres *postgres.Client + PowerBI *powerBI.Client + PrivateDns *privatedns.Client + PrivateDnsResolver *dnsresolver.Client + Purview *purview.Client + RecoveryServices *recoveryServices.Client + RedHatOpenShift *redhatopenshift.Client + Redis *redis_2023_08_01.Client + RedisEnterprise *redisenterprise.Client + Relay *relay.Client + Resource *resource.Client + Search *search.Client + SecurityCenter *securityCenter.Client + Sentinel *sentinel.Client + ServiceBus *serviceBus.Client + ServiceConnector *serviceConnector.Client + ServiceFabric *serviceFabric.Client + ServiceFabricManaged *serviceFabricManaged.Client + ServiceNetworking *servicenetworking_v2023_05_01_preview.Client + SignalR *signalr.Client + Storage *storage.Client + StorageCache *storagecache_2023_05_01.Client + StorageMover *storageMover.Client + StreamAnalytics *streamAnalytics.Client + Subscription *subscription.Client + Sql *sql.Client + Synapse *synapse.Client + SystemCenterVirtualMachineManager *systemcentervirtualmachinemanager_2023_10_07.Client + TrafficManager *trafficManager.Client + VideoAnalyzer *videoAnalyzer.Client + Vmware *vmware.Client + VoiceServices *voiceServices.Client + Web *web.Client } // NOTE: it should be possible for this method to become Private once the top level Client's removed @@ -633,6 +635,9 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error if client.TrafficManager, err = trafficManager.NewClient(o); err != nil { return fmt.Errorf("building clients for Traffic Manager: %+v", err) } + if client.TrafficManager, err = trafficManager.NewClient(o); err != nil { + return fmt.Errorf("building clients for Traffic Manager: %+v", err) + } if client.VideoAnalyzer, err = videoAnalyzer.NewClient(o); err != nil { return fmt.Errorf("building clients for Video Analyzer: %+v", err) } From cfa93d90c21b01d29d9513f05a3773b851256984 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Sun, 18 Feb 2024 12:22:49 +0800 Subject: [PATCH 15/17] update code --- .../loadbalancer/parse/load_balancer.go | 72 +++++++++++ .../loadbalancer/parse/load_balancer_test.go | 117 ------------------ internal/services/loadbalancer/resourceids.go | 1 + .../loadbalancer/validate/load_balancer_id.go | 26 ++++ 4 files changed, 99 insertions(+), 117 deletions(-) create mode 100644 internal/services/loadbalancer/parse/load_balancer.go create mode 100644 internal/services/loadbalancer/validate/load_balancer_id.go diff --git a/internal/services/loadbalancer/parse/load_balancer.go b/internal/services/loadbalancer/parse/load_balancer.go new file mode 100644 index 000000000000..693668d069e4 --- /dev/null +++ b/internal/services/loadbalancer/parse/load_balancer.go @@ -0,0 +1,72 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package parse + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +type LoadBalancerId struct { + SubscriptionId string + ResourceGroup string + Name string +} + +func NewLoadBalancerID(subscriptionId, resourceGroup, name string) LoadBalancerId { + return LoadBalancerId{ + SubscriptionId: subscriptionId, + ResourceGroup: resourceGroup, + Name: name, + } +} + +func (id LoadBalancerId) String() string { + segments := []string{ + fmt.Sprintf("Name %q", id.Name), + fmt.Sprintf("Resource Group %q", id.ResourceGroup), + } + segmentsStr := strings.Join(segments, " / ") + return fmt.Sprintf("%s: (%s)", "Load Balancer", segmentsStr) +} + +func (id LoadBalancerId) ID() string { + fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/loadBalancers/%s" + return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) +} + +// LoadBalancerID parses a LoadBalancer ID into an LoadBalancerId struct +func LoadBalancerID(input string) (*LoadBalancerId, error) { + id, err := resourceids.ParseAzureResourceID(input) + if err != nil { + return nil, fmt.Errorf("parsing %q as an LoadBalancer ID: %+v", input, err) + } + + resourceId := LoadBalancerId{ + SubscriptionId: id.SubscriptionID, + ResourceGroup: id.ResourceGroup, + } + + if resourceId.SubscriptionId == "" { + return nil, fmt.Errorf("ID was missing the 'subscriptions' element") + } + + if resourceId.ResourceGroup == "" { + return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") + } + + if resourceId.Name, err = id.PopSegment("loadBalancers"); err != nil { + return nil, err + } + + if err := id.ValidateNoEmptySegments(input); err != nil { + return nil, err + } + + return &resourceId, nil +} diff --git a/internal/services/loadbalancer/parse/load_balancer_test.go b/internal/services/loadbalancer/parse/load_balancer_test.go index be3636c47641..26dc40850fcd 100644 --- a/internal/services/loadbalancer/parse/load_balancer_test.go +++ b/internal/services/loadbalancer/parse/load_balancer_test.go @@ -113,120 +113,3 @@ func TestLoadBalancerID(t *testing.T) { } } } - -func TestLoadBalancerIDInsensitively(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LoadBalancerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1", - Expected: &LoadBalancerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "loadBalancer1", - }, - }, - - { - // lower-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadbalancers/loadBalancer1", - Expected: &LoadBalancerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "loadBalancer1", - }, - }, - - { - // upper-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/LOADBALANCERS/loadBalancer1", - Expected: &LoadBalancerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "loadBalancer1", - }, - }, - - { - // mixed-cased segment names - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/LoAdBaLaNcErS/loadBalancer1", - Expected: &LoadBalancerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "loadBalancer1", - }, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := LoadBalancerIDInsensitively(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/loadbalancer/resourceids.go b/internal/services/loadbalancer/resourceids.go index f25d2e0ef8d2..a1dc92beeb3f 100644 --- a/internal/services/loadbalancer/resourceids.go +++ b/internal/services/loadbalancer/resourceids.go @@ -4,6 +4,7 @@ package loadbalancer // Load Balancers +//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancer -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BackendAddressPoolAddress -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/backendAddressPools/backendAddressPool1/addresses/address1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancerBackendAddressPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/backendAddressPools/backendAddressPool1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancerFrontendIpConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/frontendIPConfigurations/frontendIPConfig1 -rewrite=true diff --git a/internal/services/loadbalancer/validate/load_balancer_id.go b/internal/services/loadbalancer/validate/load_balancer_id.go new file mode 100644 index 000000000000..8a171bd20b15 --- /dev/null +++ b/internal/services/loadbalancer/validate/load_balancer_id.go @@ -0,0 +1,26 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package validate + +// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten + +import ( + "fmt" + + "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" +) + +func LoadBalancerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := parse.LoadBalancerID(v); err != nil { + errors = append(errors, err) + } + + return +} From d37887cc4d8b5cf9940044a50c6469e19a239da4 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Sun, 18 Feb 2024 12:27:30 +0800 Subject: [PATCH 16/17] update code --- .../loadbalancer/parse/load_balancer.go | 72 ----------- .../loadbalancer/parse/load_balancer_test.go | 115 ------------------ .../loadbalancer/validate/load_balancer_id.go | 26 ---- .../validate/load_balancer_id_test.go | 79 ------------ 4 files changed, 292 deletions(-) delete mode 100644 internal/services/loadbalancer/parse/load_balancer.go delete mode 100644 internal/services/loadbalancer/parse/load_balancer_test.go delete mode 100644 internal/services/loadbalancer/validate/load_balancer_id.go delete mode 100644 internal/services/loadbalancer/validate/load_balancer_id_test.go diff --git a/internal/services/loadbalancer/parse/load_balancer.go b/internal/services/loadbalancer/parse/load_balancer.go deleted file mode 100644 index 693668d069e4..000000000000 --- a/internal/services/loadbalancer/parse/load_balancer.go +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - "strings" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -type LoadBalancerId struct { - SubscriptionId string - ResourceGroup string - Name string -} - -func NewLoadBalancerID(subscriptionId, resourceGroup, name string) LoadBalancerId { - return LoadBalancerId{ - SubscriptionId: subscriptionId, - ResourceGroup: resourceGroup, - Name: name, - } -} - -func (id LoadBalancerId) String() string { - segments := []string{ - fmt.Sprintf("Name %q", id.Name), - fmt.Sprintf("Resource Group %q", id.ResourceGroup), - } - segmentsStr := strings.Join(segments, " / ") - return fmt.Sprintf("%s: (%s)", "Load Balancer", segmentsStr) -} - -func (id LoadBalancerId) ID() string { - fmtString := "/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/loadBalancers/%s" - return fmt.Sprintf(fmtString, id.SubscriptionId, id.ResourceGroup, id.Name) -} - -// LoadBalancerID parses a LoadBalancer ID into an LoadBalancerId struct -func LoadBalancerID(input string) (*LoadBalancerId, error) { - id, err := resourceids.ParseAzureResourceID(input) - if err != nil { - return nil, fmt.Errorf("parsing %q as an LoadBalancer ID: %+v", input, err) - } - - resourceId := LoadBalancerId{ - SubscriptionId: id.SubscriptionID, - ResourceGroup: id.ResourceGroup, - } - - if resourceId.SubscriptionId == "" { - return nil, fmt.Errorf("ID was missing the 'subscriptions' element") - } - - if resourceId.ResourceGroup == "" { - return nil, fmt.Errorf("ID was missing the 'resourceGroups' element") - } - - if resourceId.Name, err = id.PopSegment("loadBalancers"); err != nil { - return nil, err - } - - if err := id.ValidateNoEmptySegments(input); err != nil { - return nil, err - } - - return &resourceId, nil -} diff --git a/internal/services/loadbalancer/parse/load_balancer_test.go b/internal/services/loadbalancer/parse/load_balancer_test.go deleted file mode 100644 index 26dc40850fcd..000000000000 --- a/internal/services/loadbalancer/parse/load_balancer_test.go +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package parse - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "testing" - - "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" -) - -var _ resourceids.Id = LoadBalancerId{} - -func TestLoadBalancerIDFormatter(t *testing.T) { - actual := NewLoadBalancerID("12345678-1234-9876-4563-123456789012", "resGroup1", "loadBalancer1").ID() - expected := "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1" - if actual != expected { - t.Fatalf("Expected %q but got %q", expected, actual) - } -} - -func TestLoadBalancerID(t *testing.T) { - testData := []struct { - Input string - Error bool - Expected *LoadBalancerId - }{ - - { - // empty - Input: "", - Error: true, - }, - - { - // missing SubscriptionId - Input: "/", - Error: true, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Error: true, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Error: true, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Error: true, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", - Error: true, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/", - Error: true, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1", - Expected: &LoadBalancerId{ - SubscriptionId: "12345678-1234-9876-4563-123456789012", - ResourceGroup: "resGroup1", - Name: "loadBalancer1", - }, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/LOADBALANCERS/LOADBALANCER1", - Error: true, - }, - } - - for _, v := range testData { - t.Logf("[DEBUG] Testing %q", v.Input) - - actual, err := LoadBalancerID(v.Input) - if err != nil { - if v.Error { - continue - } - - t.Fatalf("Expect a value but got an error: %s", err) - } - if v.Error { - t.Fatal("Expect an error but didn't get one") - } - - if actual.SubscriptionId != v.Expected.SubscriptionId { - t.Fatalf("Expected %q but got %q for SubscriptionId", v.Expected.SubscriptionId, actual.SubscriptionId) - } - if actual.ResourceGroup != v.Expected.ResourceGroup { - t.Fatalf("Expected %q but got %q for ResourceGroup", v.Expected.ResourceGroup, actual.ResourceGroup) - } - if actual.Name != v.Expected.Name { - t.Fatalf("Expected %q but got %q for Name", v.Expected.Name, actual.Name) - } - } -} diff --git a/internal/services/loadbalancer/validate/load_balancer_id.go b/internal/services/loadbalancer/validate/load_balancer_id.go deleted file mode 100644 index 8a171bd20b15..000000000000 --- a/internal/services/loadbalancer/validate/load_balancer_id.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import ( - "fmt" - - "github.com/hashicorp/terraform-provider-azurerm/internal/services/loadbalancer/parse" -) - -func LoadBalancerID(input interface{}, key string) (warnings []string, errors []error) { - v, ok := input.(string) - if !ok { - errors = append(errors, fmt.Errorf("expected %q to be a string", key)) - return - } - - if _, err := parse.LoadBalancerID(v); err != nil { - errors = append(errors, err) - } - - return -} diff --git a/internal/services/loadbalancer/validate/load_balancer_id_test.go b/internal/services/loadbalancer/validate/load_balancer_id_test.go deleted file mode 100644 index 402862a0219f..000000000000 --- a/internal/services/loadbalancer/validate/load_balancer_id_test.go +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package validate - -// NOTE: this file is generated via 'go:generate' - manual changes will be overwritten - -import "testing" - -func TestLoadBalancerID(t *testing.T) { - cases := []struct { - Input string - Valid bool - }{ - - { - // empty - Input: "", - Valid: false, - }, - - { - // missing SubscriptionId - Input: "/", - Valid: false, - }, - - { - // missing value for SubscriptionId - Input: "/subscriptions/", - Valid: false, - }, - - { - // missing ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/", - Valid: false, - }, - - { - // missing value for ResourceGroup - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/", - Valid: false, - }, - - { - // missing Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/", - Valid: false, - }, - - { - // missing value for Name - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/", - Valid: false, - }, - - { - // valid - Input: "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1", - Valid: true, - }, - - { - // upper-cased - Input: "/SUBSCRIPTIONS/12345678-1234-9876-4563-123456789012/RESOURCEGROUPS/RESGROUP1/PROVIDERS/MICROSOFT.NETWORK/LOADBALANCERS/LOADBALANCER1", - Valid: false, - }, - } - for _, tc := range cases { - t.Logf("[DEBUG] Testing Value %s", tc.Input) - _, errors := LoadBalancerID(tc.Input, "test") - valid := len(errors) == 0 - - if tc.Valid != valid { - t.Fatalf("Expected %t but got %t", tc.Valid, valid) - } - } -} From 85e68e096d899798c2eb9c21329fac90957a01b5 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Sun, 18 Feb 2024 12:27:35 +0800 Subject: [PATCH 17/17] update code --- internal/services/loadbalancer/resourceids.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/services/loadbalancer/resourceids.go b/internal/services/loadbalancer/resourceids.go index a1dc92beeb3f..f25d2e0ef8d2 100644 --- a/internal/services/loadbalancer/resourceids.go +++ b/internal/services/loadbalancer/resourceids.go @@ -4,7 +4,6 @@ package loadbalancer // Load Balancers -//go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancer -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=BackendAddressPoolAddress -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/backendAddressPools/backendAddressPool1/addresses/address1 //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancerBackendAddressPool -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/backendAddressPools/backendAddressPool1 -rewrite=true //go:generate go run ../../tools/generator-resource-id/main.go -path=./ -name=LoadBalancerFrontendIpConfiguration -id=/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/resGroup1/providers/Microsoft.Network/loadBalancers/loadBalancer1/frontendIPConfigurations/frontendIPConfig1 -rewrite=true